Skip to main content

ClikaRT::ops::mm

function

mm()

Tensor mm(
    Tensor a,
    Tensor b,
    OptionalTensor bias = {},
    std::optional<Activation> activation = std::nullopt
)

Matrix multiply of two rank-2 tensors, with an optional fused bias and activation epilogue.

out=act(ab+bias)\mathrm{out} = \mathrm{act}(a\,b + \mathrm{bias})

a [M, K] x b [K, N] -> [M, N]. Inputs must be rank-2 (use bmm for batched operands, matmul for the broadcasting general form).

Parameters

  • a: left operand [M, K].
  • b: right operand [K, N].
  • bias: optional additive bias, broadcastable to [M, N] (e.g. [N]).
  • activation: optional fused epilogue; absent = none.

Returns: [M, N], the operands' promoted float dtype.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when either operand is not rank-2 or the inner dims disagree.
auto y = ClikaRT::ops::mm(x, W, b, ClikaRT::ops::Activation::Relu);

Declared in ClikaRT/compute/ops.h, line 2765