评价此页

torch.nn.functional.linear#

torch.nn.functional.linear(input, weight, bias=None) Tensor#

将输入数据进行线性变换:y=xAT+by = xA^T + b.

此操作支持具有稀疏布局的二维weight

警告

稀疏支持是测试版功能,某些布局/数据类型/设备组合可能不支持,或可能不支持自动求导。如果您发现缺少功能,请提交功能请求。

此操作符支持TensorFloat32

形状

  • 输入:(,in_features)(*, in\_features),其中*表示任何数量的附加维度,包括零个

  • 权重:(out_features,in_features)(out\_features, in\_features)(in_features)(in\_features)

  • 偏置:(out_features)(out\_features)()()

  • 输出: (,out_features)(*, out\_features)()(*),具体取决于权重的形状