forward method

Tensor forward(
  1. Tensor x
)

Implementation

Tensor forward(Tensor x) {
  // Standard Linear Transformation: xW + b
  Tensor out = x.matmul(weights) + bias;

  // Use GELU instead of ReLU to prevent "Dead Neurons"
  return useGelu ? out.gelu() : out;
}