Skip to main content

gather_qmm

Function gather_qmm 

Source
pub fn gather_qmm<'b, 'lhs, 'rhs>(
    x: impl AsRef<Array>,
    w: impl AsRef<Array>,
    scales: impl AsRef<Array>,
    biases: impl Into<Option<&'b Array>>,
    lhs_indices: impl Into<Option<&'lhs Array>>,
    rhs_indices: impl Into<Option<&'rhs Array>>,
    transpose: impl Into<Option<bool>>,
    group_size: impl Into<Option<i32>>,
    bits: impl Into<Option<i32>>,
    sorted_indices: impl Into<Option<bool>>,
) -> Result<Array>
Expand description

Perform quantized matrix multiplication with gathered indices.

This combines the functionality of gather_mm and quantized_matmul, allowing matrix multiplication with quantized weights and index gathering along batch dimensions.

§Params

  • x: Input array
  • w: Quantized weight matrix
  • scales: Quantization scales
  • biases: Optional quantization biases (required for affine mode)
  • lhs_indices: Optional indices to gather from x’s batch dimensions
  • rhs_indices: Optional indices to gather from w’s batch dimensions
  • transpose: If true, transpose the weight matrix (default: true)
  • group_size: The quantization group size (default: 64)
  • bits: The number of bits per element (default: 4)
  • sorted_indices: If true, indicates the indices are sorted (default: false)