本文簡要介紹python語言中 torch.addmm 的用法。
用法:
torch.addmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) → Tensorbeta(數字,可選的) -
input() 的乘數alpha(數字,可選的) - () 的乘數
out(Tensor,可選的) -輸出張量。
執行矩陣
mat1和mat2的矩陣乘法。矩陣input被添加到最終結果中。如果
mat1是張量,mat2是張量,那麽input必須是可廣播的張量並且out將是張量。alpha和beta分別是mat1和mat2和添加的矩陣input之間的 matrix-vector 產品的比例因子。如果
beta為0,則input將被忽略,其中的nan和inf不會被傳播。對於
FloatTensor或DoubleTensor類型的輸入,參數beta和alpha必須是實數,否則它們應該是整數。該運算符支持 TensorFloat32。
例子:
>>> M = torch.randn(2, 3) >>> mat1 = torch.randn(2, 3) >>> mat2 = torch.randn(3, 3) >>> torch.addmm(M, mat1, mat2) tensor([[-4.8716, 1.4671, -1.3746], [ 0.7573, -3.9555, -2.8681]])
參數:
關鍵字參數:
相關用法
- Python PyTorch addmv用法及代碼示例
- Python PyTorch add用法及代碼示例
- Python PyTorch addcdiv用法及代碼示例
- Python PyTorch addbmm用法及代碼示例
- Python PyTorch addr用法及代碼示例
- Python PyTorch addcmul用法及代碼示例
- Python PyTorch argsort用法及代碼示例
- Python PyTorch apply_effects_tensor用法及代碼示例
- Python PyTorch assert_close用法及代碼示例
- Python PyTorch angle用法及代碼示例
- Python PyTorch all_reduce用法及代碼示例
- Python PyTorch atanh用法及代碼示例
- Python PyTorch annotate用法及代碼示例
- Python PyTorch async_execution用法及代碼示例
- Python PyTorch argmax用法及代碼示例
- Python PyTorch atan用法及代碼示例
- Python PyTorch as_strided用法及代碼示例
- Python PyTorch acos用法及代碼示例
- Python PyTorch all_gather用法及代碼示例
- Python PyTorch avg_pool1d用法及代碼示例
- Python PyTorch asin用法及代碼示例
- Python PyTorch allreduce_hook用法及代碼示例
- Python PyTorch argmin用法及代碼示例
- Python PyTorch any用法及代碼示例
- Python PyTorch all_to_all用法及代碼示例
注:本文由純淨天空篩選整理自pytorch.org大神的英文原創作品 torch.addmm。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
