Skip to content

Add QInt8, QUInt8, QInt32 quantized scalar types with full quantizati…#1531

Open
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912:qint_type
Open

Add QInt8, QUInt8, QInt32 quantized scalar types with full quantizati…#1531
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912:qint_type

Conversation

@alinpahontu2912
Copy link
Member

…on support

  • Uncomment and fix ScalarType enum entries (QInt8=12, QUInt8=13, QInt32=14)
  • Fix incorrect QUInt32 name to QInt32 to match PyTorch
  • Add torch.qint8, torch.quint8, torch.qint32 dtype aliases
  • Add torch.is_quantized() and Tensor.is_quantized() methods
  • Add IsQuantized() extension method on ScalarType

Native quantization bindings:

  • Add THSTensor_quantize_per_tensor, THSTensor_quantize_per_channel (C++ and P/Invoke)
  • Add THSTensor_dequantize (C++ and P/Invoke)
  • Add THSTensor_q_scale, THSTensor_q_zero_point (C++ and P/Invoke)
  • Add THSTensor_int_repr (C++ and P/Invoke)
  • Add THSTensor_q_per_channel_scales, THSTensor_q_per_channel_zero_points, THSTensor_q_per_channel_axis (C++ and P/Invoke)

Managed API:

  • Add torch.quantize_per_tensor() and torch.quantize_per_channel() static methods
  • Add torch.dequantize() static method
  • Add Tensor.dequantize(), Tensor.q_scale(), Tensor.q_zero_point() instance methods
  • Add Tensor.int_repr() instance method
  • Add Tensor.q_per_channel_scales(), Tensor.q_per_channel_zero_points(), Tensor.q_per_channel_axis() instance methods

Unit tests for all new functionality (13 tests)

…on support

- Uncomment and fix ScalarType enum entries (QInt8=12, QUInt8=13, QInt32=14)
- Fix incorrect QUInt32 name to QInt32 to match PyTorch
- Add torch.qint8, torch.quint8, torch.qint32 dtype aliases
- Add torch.is_quantized() and Tensor.is_quantized() methods
- Add IsQuantized() extension method on ScalarType

Native quantization bindings:
- Add THSTensor_quantize_per_tensor, THSTensor_quantize_per_channel (C++ and P/Invoke)
- Add THSTensor_dequantize (C++ and P/Invoke)
- Add THSTensor_q_scale, THSTensor_q_zero_point (C++ and P/Invoke)
- Add THSTensor_int_repr (C++ and P/Invoke)
- Add THSTensor_q_per_channel_scales, THSTensor_q_per_channel_zero_points, THSTensor_q_per_channel_axis (C++ and P/Invoke)

Managed API:
- Add torch.quantize_per_tensor() and torch.quantize_per_channel() static methods
- Add torch.dequantize() static method
- Add Tensor.dequantize(), Tensor.q_scale(), Tensor.q_zero_point() instance methods
- Add Tensor.int_repr() instance method
- Add Tensor.q_per_channel_scales(), Tensor.q_per_channel_zero_points(), Tensor.q_per_channel_axis() instance methods

Unit tests for all new functionality (13 tests)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant