| 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)]: |