pytorch/c10/util/Half.cpp
Jerry Zhang dfcd7b0185 QTensor (#18230)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18230

Implementing minimum qtensor API to unblock other workstreams in quantization

Changes:
- Added Quantizer which represents different quantization schemes
- Added qint8 as a data type for QTensor
- Added a new ScalarType QInt8
- Added QTensorImpl for QTensor
- Added following user facing APIs
  - quantize_linear(scale, zero_point)
  - dequantize()
  - q_scale()
  - q_zero_point()

Reviewed By: dzhulgakov

Differential Revision: D14524641

fbshipit-source-id: c1c0ae0978fb500d47cdb23fb15b747773429e6c
2019-04-03 13:17:11 -07:00

15 lines
289 B
C++

#include <c10/util/Half.h>
#include <iostream>
namespace c10 {
static_assert(
std::is_standard_layout<Half>::value,
"c10::Half must be standard layout.");
std::ostream& operator<<(std::ostream& out, const Half& value) {
out << (float)value;
return out;
}
} // namespace c10