Skip to content

Commit e2549cc

Browse files
update rtol (#3525)
### Changes Update rtol ### Reason for changes Fails for onnxruntime versions < 1.21.1 due to significant differences ### Related tickets N/A ### Tests weekly
1 parent 3ae6f4c commit e2549cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/onnx/quantization/test_weights_compression.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import numpy as np
1414
import onnx
15+
import onnxruntime
1516
import pytest
1617
from onnx import TensorProto
1718
from onnx import helper
@@ -267,6 +268,10 @@ def test_compression_with_inference(mode):
267268

268269

269270
def test_matmulnbits():
271+
rtol = 1e-5
272+
if onnxruntime.__version__ < "1.21.1":
273+
rtol = 1e-3
274+
270275
np.random.seed(42)
271276
model_opset21 = create_model()
272277

@@ -284,4 +289,4 @@ def test_matmulnbits():
284289
output21 = sess21.run(None, {"input": dummy_input})[0]
285290
output19 = sess19.run(None, {"input": dummy_input})[0]
286291

287-
assert np.allclose(output21, output19, rtol=1e-5, atol=1e-6)
292+
assert np.allclose(output21, output19, rtol=rtol, atol=1e-6)

0 commit comments

Comments
 (0)