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

Method quantize

python/tests/test_quantized.py:757–766  ·  view source on GitHub ↗
(w, transpose=True, group_size=None, bits=None, mode="affine")

Source from the content-addressed store, hash-verified

755
756 def test_gather_qmm(self):
757 def quantize(w, transpose=True, group_size=None, bits=None, mode="affine"):
758 if mode == "affine":
759 qw, s, b = mx.quantize(w, group_size=group_size, bits=bits, mode=mode)
760 else:
761 qw, s = mx.quantize(w, group_size=group_size, bits=bits, mode=mode)
762 b = None
763 w_hat = mx.dequantize(qw, s, b, group_size=group_size, bits=bits, mode=mode)
764 if transpose:
765 w_hat = w_hat.swapaxes(-1, -2)
766 return w_hat, qw, s, b
767
768 def test_shape(
769 M,

Callers 15

test_quantizeMethod · 0.45
test_qqmvMethod · 0.45
test_qmmMethod · 0.45
test_qmm_vjpMethod · 0.45
test_qmm_jvpMethod · 0.45
test_qmm_shapesMethod · 0.45
test_qmvMethod · 0.45
test_fp_qmvMethod · 0.45

Calls 1

dequantizeMethod · 0.80

Tested by

no test coverage detected