torch:linear
(torch:linear in-features out-features &key bias)
Returns a fully connected layer (PyTorch's nn.Linear): the field :weight is an (in-features out-features) parameter and :bias an (out-features) parameter, or nil under :bias nil. The forward is x . W (+ b), so the bias broadcasts over every leading axis and an input of rank 3 is transformed batch-wise.
Both parameters are drawn from PyTorch's default U(-1/sqrt(in-features), 1/sqrt(in-features)) using the seeded linalg:seed generator, so a seeded run reproduces on every backend. The weight is stored (in out) -- not PyTorch's transposed (out in) -- so the forward is a plain torch:matmul.