快捷方式

torch.nn.functional.linear

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

對輸入資料應用線性變換:y=xAT+by = xA^T + b

此操作支援具有稀疏佈局的二維 weight

警告

稀疏支援是 Beta 功能,某些佈局/資料型別/裝置組合可能不受支援,或可能沒有 Autograd 支援。如果您發現缺少功能,請提交功能請求。

此運算子支援TensorFloat32

形狀

  • 輸入:(,in_features)(*, in\_features),其中 * 表示任意數量的額外維度,包括零維度

  • Weight:(out_features,in_features)(out\_features, in\_features)(in_features)(in\_features)

  • Bias:(out_features)(out\_features)()()

  • 輸出:(,out_features)(*, out\_features)()(*),取決於 weight 的形狀

文件

查閱 PyTorch 全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲取問題解答

檢視資源