MCPcopy Create free account
hub / github.com/ml-explore/mlx / test_throw

Method test_throw

python/tests/test_quantized.py:571–585  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

569 )
570
571 def test_throw(self):
572 x = mx.random.normal(shape=(10, 512))
573 w = mx.random.normal(shape=(32, 512))
574 w_q, scales, biases = mx.quantize(w)
575
576 with self.assertRaises(ValueError):
577 mx.quantized_matmul(x, w_q.T, scales, biases)
578 with self.assertRaises(ValueError):
579 mx.quantized_matmul(x, w_q.T, scales.T, biases)
580 with self.assertRaises(ValueError):
581 mx.quantized_matmul(x, w_q, scales, biases, False)
582 with self.assertRaises(ValueError):
583 mx.quantized_matmul(x, w_q, scales.T, biases.T)
584 y = mx.quantized_matmul(x, w_q, scales, biases, True)
585 mx.eval(y)
586
587 def test_small_matrix(self):
588 for w_shape in [(8, 256), (1, 8, 256), (3, 8, 256)]:

Callers

nothing calls this directly

Calls 2

quantizeMethod · 0.45
evalMethod · 0.45

Tested by

no test coverage detected