xref: /aosp_15_r20/external/pytorch/c10/util/qint8.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 #include <cstdint>
3 
4 #include <c10/macros/Macros.h>
5 
6 namespace c10 {
7 
8 /**
9  * This is the data type for quantized Tensors. Right now we only have
10  * qint8 which is for 8 bit Tensors, and qint32 for 32 bit int Tensors,
11  * we might have 4 bit, 2 bit or 1 bit data types in the future.
12  */
13 struct alignas(1) qint8 {
14   using underlying = int8_t;
15   int8_t val_;
16   qint8() = default;
qint8qint817   C10_HOST_DEVICE explicit qint8(int8_t val) : val_(val) {}
18 };
19 
20 } // namespace c10
21