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

Method test_quantize_strided

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

Source from the content-addressed store, hash-verified

1158 ds = mx.grad(gmm)(s, x, wq)
1159
1160 def test_quantize_strided(self):
1161 N = 64
1162 mode = "nvfp4"
1163 w = mx.random.normal(shape=(N, N))
1164 w_q, scales = mx.quantize(w, mode="nvfp4")
1165
1166 scales = mx.broadcast_to(mx.array(56, mx.uint8), scales.shape)
1167 w_hat = mx.dequantize(w_q, scales, mode=mode)
1168 expected = mx.dequantize(w_q, mx.contiguous(scales), mode=mode)
1169 self.assertTrue(mx.allclose(w_hat, expected))
1170
1171
1172if __name__ == "__main__":

Callers

nothing calls this directly

Calls 3

dequantizeMethod · 0.80
arrayMethod · 0.60
quantizeMethod · 0.45

Tested by

no test coverage detected