From f0bf2bf09a9b740643ad9ba5555f518274291b7f Mon Sep 17 00:00:00 2001 From: Angelos Katharopoulos Date: Tue, 26 Dec 2023 17:59:33 -0800 Subject: [PATCH] Fix tolerance in de-/quantization test --- python/tests/test_quantized.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tests/test_quantized.py b/python/tests/test_quantized.py index 5fcc882a5..049f92fdb 100644 --- a/python/tests/test_quantized.py +++ b/python/tests/test_quantized.py @@ -13,7 +13,8 @@ class TestQuantized(mlx_tests.MLXTestCase): w_q, scales, biases = mx.quantize(w, 64, b) w_hat = mx.dequantize(w_q, scales, biases, 64, b) errors = (w - w_hat).abs().reshape(*scales.shape, -1) - self.assertTrue((errors <= scales[..., None] / 2).all()) + eps = 1e-6 + self.assertTrue((errors <= (scales[..., None] / 2 + eps)).all()) def test_qmm(self): key = mx.random.key(0)