diff --git a/tests/_test_utils/torch/quantization/tensor_quant_common.py b/tests/_test_utils/torch/quantization/tensor_quant_common.py index 5119519ed02..7205e0c79c5 100644 --- a/tests/_test_utils/torch/quantization/tensor_quant_common.py +++ b/tests/_test_utils/torch/quantization/tensor_quant_common.py @@ -36,6 +36,7 @@ def test_simple_run(self): def test_per_tensor_scale(self): """Tensor_quant matches quantization""" + torch.manual_seed(123) # an element on a rounding tie rounds differently in the reference x = torch.randn(31).to(self.device) quant_x_ref = quant( x, diff --git a/tests/_test_utils/torch/quantization/tensor_quantizer_common.py b/tests/_test_utils/torch/quantization/tensor_quantizer_common.py index 77d3acb7df3..c7ec0c2e53d 100644 --- a/tests/_test_utils/torch/quantization/tensor_quantizer_common.py +++ b/tests/_test_utils/torch/quantization/tensor_quantizer_common.py @@ -45,6 +45,7 @@ def test_simple_run(self): def test_per_tensor_scale(self): """Quantizer performs expected quantization""" + torch.manual_seed(123) # an element on a rounding tie rounds differently in the reference x = torch.randn(31).to(self.device) quant_x = quant(x, torch.max(torch.abs(x)), fake=True) @@ -54,6 +55,7 @@ def test_per_tensor_scale(self): def test_per_channel_scale(self): """Quantizer performs per channel scaling""" + torch.manual_seed(123) # an element on a rounding tie rounds differently in the reference x = torch.randn(5, 5, 4, 8).to(self.device) # Pytorch filter layout seems to be KCRS, reduce max to shape [K, 1, 1, 1] to test per channel scale