Linear
- class torch.nn.modules.linear.Linear(in_features, out_features, bias=True, device=None, dtype=None)
Applies an affine linear transformation to the incoming data: .
Applies an affine linear transformation to the incoming data: .
This module supports TensorFloat32.
On certain ROCm devices, when using float16 inputs this module will use different precision for backward.
Input: where means any number of dimensions including none and .
Output: where all but the last dimension are the same shape as the input and .
weight (torch.Tensor) – the learnable weights of the module of shape . The values are initialized from , where
bias – the learnable bias of the module of shape .
If bias is True, the values are initialized from
where
Examples:
>>> m = nn.Linear(20, 30)
>>> input = torch.randn(128, 20)
>>> output = m(input)
>>> print(output.size())
torch.Size([128, 30])
Return the extra representation of the module.
Runs the forward pass.
Resets parameters based on their initialization used in __init__.