mlx.core.quantized_matmul#
- mlx.core.quantized_matmul(x: array, w: array, /, scales: array, biases: array, transpose: bool = True, group_size: int = 64, bits: int = 4, *, stream: Union[None, Stream, Device] = None) array#
Perform the matrix multiplication with the quantized matrix
w. The quantization uses one floating point scale and bias pergroup_sizeof elements. Each element inwtakesbitsbits and is packed in an unsigned 32 bit integer.- Parameters:
x (array) – Input array
w (array) – Quantized matrix packed in unsigned integers
scales (array) – The scales to use per
group_sizeelements ofwbiases (array) – The biases to use per
group_sizeelements ofwtranspose (bool, optional) – Defines whether to multiply with the transposed
wor not, namely whether we are performingx @ w.Torx @ w. (default:True)group_size (int, optional) – The size of the group in
wthat shares a scale and bias. (default:64)bits (int, optional) – The number of bits occupied by each element in
w. (default:4)
- Returns:
The result of the multiplication of
xwithw.- Return type:
result (array)