matmul

Contents

matmul#

class braintrace.matmul(x, weight, bias=None)[source]#

ETP-aware matrix multiplication.

Computes \(y = x \mathbin{@} w \; (+ b)\).

Auto-dispatches to etp_mm_p (batched) or etp_mv_p (unbatched) based on x.ndim.

Parameters:
  • x – Input array, shape (..., in_features) or (in_features,).

  • weight – Weight matrix, shape (in_features, out_features).

  • bias – Optional bias vector, shape (out_features,).

Returns:

Output array.