// Author: Simon-Pierre Boucher — contact@spboucher.ai #include "nn/linear.h" #include "ops/ops.h" namespace forge::nn { Var Linear::forward(const Var& x) const { Var w = mask_.defined() ? ops::mul(weight_, mask_) : weight_; if (quant_ != ops::QuantMode::None) w = ops::fake_quant(w, quant_); Var y = ops::matmul(x, w, /*transpose_a=*/false, /*transpose_b=*/true); if (bias_.defined()) y = ops::add_bias(y, bias_); return y; } } // namespace forge::nn