Skip to content
masterclass Buddy

PyTorch · Function

F.linear

torch.nn.functional.linear computes a linear transformation from an input tensor, weight, and optional bias. It supports inputs with leading dimensions and can use either matrix or vector weights.

Last updated

Syntax

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

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • torch.nn.functional
  • torch.nn.Linear

Source: torch.nn.functional.linear — PyTorch 2.14 documentation. Checked 2026-11-03.