qint8.h 472 B

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