Linear#
- classtorch.nn.Linear(in_features,out_features,bias=True,device=None,dtype=None)[source]#
Applies an affine linear transformation to the incoming data:.
This module supportsTensorFloat32.
On certain ROCm devices, when using float16 inputs this module will usedifferent precision for backward.
- Parameters
- Shape:
Input: where means any number ofdimensions including none and.
Output: where all but the last dimensionare the same shape as the input and.
- Variables
weight (torch.Tensor) – the learnable weights of the module of shape. The values areinitialized from, where
bias – the learnable bias of the module of shape.If
biasisTrue, 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])