티스토리 뷰

ML & DL/PyTorch

torch.nn.Linear

Enna 2023. 2. 20. 15:49

torch.nn.Linear(*in_features*, *out_features*, *bias=True*, *device=None*, *dtype=None*)

Parameters

  • in_features (int): size of each input sample
  • out_features (int): size of each output sample
  • bias (bool): If set to False, the layer will not learn an additive bias. Default: True

Shape

  • Input
  • $(*,H_{in})$ where �닓 means any number of dimensions including none
  • $(*,H_{in})= in_features$
  • Output
  • $(*,H_{out})$ where all but the last dimension are the same shape as the input
  • $(*,H_{out})=out_features$

Variables

  • weight (torch.Tensor): learnable weights of the module of shape $(out_features, in_features)$
  • bias
  • learnable bias of the module of shape $(out_features)$
  • if bias is True, the values are initialized

'ML & DL > PyTorch' 카테고리의 다른 글

no_grad vs. requires_grad  (0) 2023.02.20
Dataset & DataLoader  (0) 2023.02.20
torch.optim.Optimizer  (0) 2023.02.20
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/06   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
글 보관함