Linear
对输入数据应用线性变换:y = xA^T + b
torch.nn.Linear(in_features, out_features, bias=True)
参数
in_features每个输入样本的大小out_features每个输出样本的大小bias若为False,layer不会学习附加偏差b
shape
-
输入:
(N, ∗, H_in),其中∗代表任意数量的附加维度,H_in = in_features -
输出:
(N, *, H_out),除了最后一个维度,其余都与输入相同,H_out = out_features