CLASS torch.nn.Linear(in_features, out_features, bias=True)
原理:矩阵相乘,和数学上的形式完全一致
参数
in_features – size of each input sample
out_features – size of each output sample
bias – If set to False, the layer will not learn an additive bias. Default: True
shape
Input: (N, *, H_{in})(N,∗,H
in
) where *∗ means any number of additional dimensions and H_{in} = \text{in\_features}H
in
=in_features
Output: (N, *, H_{out})(N,∗,H
out
) where all but the last dimension are the same shape as the input and H_{out} = \text{out\_features}H
out
=out_features .