Fix tolerance in de-/quantization test (#295)

This commit is contained in:
Angelos Katharopoulos 2023-12-26 19:21:05 -08:00 committed by GitHub
parent fc4e5b476b
commit 447bc089b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)