Skip to content

Commit

Permalink
Run lintrunner
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlizarraga committed Nov 5, 2023
1 parent d690304 commit 7ba1921
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions onnxruntime/python/tools/quantization/onnx_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,8 +1211,9 @@ def calculate_quantization_params(self):
rmin, rmax = td.range_value
qmin, qmax = get_qmin_qmax_for_qType(self.activation_qType, symmetric=self.is_activation_symmetric)

zero, scale = compute_scale_zp(rmin, rmax, qmin, qmax, self.is_activation_symmetric,
self.quant_min_rrange)
zero, scale = compute_scale_zp(
rmin, rmax, qmin, qmax, self.is_activation_symmetric, self.quant_min_rrange
)
quantization_params[tensor_name] = QuantizationParams(zero_point=zero, scale=scale)

return quantization_params
4 changes: 3 additions & 1 deletion onnxruntime/test/python/quantization/test_quant_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def test_compute_scale_zp(self):
self.assertEqual(compute_scale_zp(0.0, 0.0, 0, 255, symmetric=False, min_rrange=0.0001), [0, 0.0001 / 255])
self.assertEqual(compute_scale_zp(0.0, 0.0, -128, 127, symmetric=True, min_rrange=0.0001), [0, 0.0002 / 255])
self.assertEqual(compute_scale_zp(0.0, 0.0, 0, 65535, symmetric=False, min_rrange=0.0001), [0, 0.0001 / 65535])
self.assertEqual(compute_scale_zp(0.0, 0.0, -32768, 32767, symmetric=True, min_rrange=0.0001), [0, 0.0002 / 65535])
self.assertEqual(
compute_scale_zp(0.0, 0.0, -32768, 32767, symmetric=True, min_rrange=0.0001), [0, 0.0002 / 65535]
)

def test_load_external_model(self):
input_name = "input"
Expand Down

0 comments on commit 7ba1921

Please sign in to comment.