A fully connected layer is an operation that takes as input a tensor of size (∗,in_features) and outputs a tensor of size (∗, out_features), where \(*\) means any number of additional dimensions. It performs an affine transformation of the last dimension of the input tensor through the operation \[A^TX + b,\] where \(A\) is the weight matrix of size (in_features, out_features) and \(b\) is the bias term of size out_features. This transforms the last dimension of the input tensor from in_features to out_features
>>> m = nn.Linear(20, 30) >>> input = torch.randn(128, 20) >>> output = m(input) >>> print(output.size())
See torch.nn.Linear for more details.