Jun Hyuk Kim's Blog
[Coding] nn.Linear 본문
nn.Linear is used to create a linear transform layer.
Parameters
- in_features, out_features: The shape of the input and output.
- bias(True): If false the bias is removed.
- dtype(None): Sets the dtype of tensors inside the layer. If set to 'None' it will default to 'torch.float32'
A lab is provided, but here are some important parts…
- The linear transformation is made up of a weight and bias matrix.
- The shape of the weight matrix is (out, in), but when it is multiplied, it is changed to (in, out).
- The shape of the bias matrix is (out), but if the bias option is False then it doesn’t exist.
- The dtype of the tensor is set to torch.float32 if not specified.
- You can use model.weight and model.bias to get the actual matrices.
'Coding Journal > AI' 카테고리의 다른 글
| [Terms] Boosting (0) | 2023.05.22 |
|---|---|
| [Terms] Bagging (0) | 2023.05.21 |
| [Thought] A lower learn rate might cause underfitting (0) | 2023.05.20 |
| [Terms] Bias and Variance Tradeoff (0) | 2023.05.20 |
| [Coding] DataFrame.groupby (0) | 2023.05.18 |