torch.nn.functional.linear — PyTorch 2.7 documentation (original) (raw)

torch.nn.functional.linear(input, weight, bias=None) → Tensor

Applies a linear transformation to the incoming data: y=xAT+by = xA^T + b.

This operation supports 2-D weight with sparse layout

Warning

Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, or may not have autograd support. If you notice missing functionality please open a feature request.

This operator supports TensorFloat32.

Shape: