torch.addmm
-
torch.addmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) → Tensor -
Performs a matrix multiplication of the matrices
mat1andmat2. The matrixinputis added to the final result.If
mat1is a tensor,mat2is a tensor, theninputmust be broadcastable with a tensor andoutwill be a tensor.alphaandbetaare scaling factors on matrix-vector product betweenmat1andmat2and the added matrixinputrespectively.If
betais 0, theninputwill be ignored, andnanandinfin it will not be propagated.For inputs of type
FloatTensororDoubleTensor, argumentsbetaandalphamust be real numbers, otherwise they should be integers.This operator supports TensorFloat32.
- Parameters
- Keyword Arguments
-
-
beta (Number, optional) – multiplier for
input( ) - alpha (Number, optional) – multiplier for ( )
- out (Tensor, optional) – the output tensor.
-
beta (Number, optional) – multiplier for
Example:
>>> 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]])
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.8.0/generated/torch.addmm.html