Linear
Function
PyTorch Linear is used to create a fully connected layer for linear transformation
.
Prototype
torch.nn.Linear(
in_features: int,
out_features: int,
bias: bool = True,
device=None,
dtype=None
)
Parameters
Parameter |
Type |
Mandatory (Yes/No) |
Description |
|---|---|---|---|
in_features |
int |
Yes |
Input feature dimension |
out_features |
int |
Yes |
Output feature dimension |
bias |
bool |
No |
Whether to include the bias (default value: True) |
device |
torch.device |
No |
Computing device (for example, cpu or cuda) |
dtype |
torch.dtype |
No |
Weight data type (for example, torch.float16 or torch.float32) |
Parent topic: Operator Interfaces