core/nn/linear library

Linear (affine) layer — y = x @ W.T + b.

Weight shape [outFeatures, inFeatures] (same convention as PyTorch's nn.Linear). Bias is optional — if bias == false, the module trains W only.

Currently uses row-broadcast add for the bias, which restricts GPU support to what's already implemented in add_tensor_row_broadcast. For CPU (default for small tensors), all shapes are supported.

Classes

Linear