@@ -123,7 +123,7 @@ def test_q_linear_module_per_channel(self, quantize_activation):
123
123
x = x .to (device )
124
124
out_quant_xla = m (x )
125
125
self .assertTrue (torch .allclose (out_fp , out_quant , atol = 0.01 ))
126
- self .assertTrue (torch .allclose (out_quant_xla .cpu (), out_quant ))
126
+ self .assertTrue (torch .allclose (out_quant_xla .cpu (), out_quant , atol = 2e-3 ))
127
127
128
128
@parameterized .parameters ([False , True ])
129
129
def test_q_linear_module_dynamo (self , quantize_activation ):
@@ -139,7 +139,8 @@ def test_q_linear_module_dynamo(self, quantize_activation):
139
139
m_dynamo = torch .compile (m , backend = "openxla" )
140
140
out_quant_dynamo = m_dynamo (x .to (device ))
141
141
self .assertTrue (torch .allclose (out_fp , out_quant , atol = 0.02 ))
142
- self .assertTrue (torch .allclose (out_quant_dynamo .cpu (), out_quant ))
142
+ self .assertTrue (
143
+ torch .allclose (out_quant_dynamo .cpu (), out_quant , atol = 4e-3 ))
143
144
144
145
@parameterized .parameters ([False , True ])
145
146
def test_q_linear_hlo (self , quantize_activation ):
@@ -240,7 +241,7 @@ def test_blockwise_linear_module(self):
240
241
x = x .to (device )
241
242
out_quant_xla = m (x )
242
243
self .assertGreater (
243
- self ._calc_cosine_dist (out_quant_xla .cpu (), out_quant ), 0.999999 )
244
+ self ._calc_cosine_dist (out_quant_xla .cpu (), out_quant ), 0.99999 )
244
245
245
246
@parameterized .parameters ([False , True ])
246
247
def test_asymmetric_per_channel (self , quantize_activation ):
@@ -263,7 +264,7 @@ def test_asymmetric_per_channel(self, quantize_activation):
263
264
x = x .to (device )
264
265
out_quant_xla = m (x )
265
266
self .assertGreater (
266
- self ._calc_cosine_dist (out_quant_xla .cpu (), out_quant ), 0.999999 )
267
+ self ._calc_cosine_dist (out_quant_xla .cpu (), out_quant ), 0.99999 )
267
268
268
269
def test_asymmetric_blockwise (self ):
269
270
for n_bit in [8 ]:
0 commit comments