快捷键

torch.nn.functional.linear

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

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

此操作支持 2-D weight 稀疏布局

警告

稀疏支持是测试版功能,某些布局(s)/dtype/设备组合可能不受支持,或者可能没有自动微分支持。如果您发现缺少功能,请提交功能请求。

此运算符支持 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)()(*) ,基于权重的形状


© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源