本文簡要介紹python語言中 torch.addmm
的用法。
用法:
torch.addmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) → Tensor
beta(數字,可選的) -
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。