torch.addmv¶
-
torch.
addmv
(input, mat, vec, *, beta=1, alpha=1, out=None) → Tensor¶ Performs a matrix-vector product of the matrix
mat
and the vectorvec
. The vectorinput
is added to the final result.If
mat
is a tensor,vec
is a 1-D tensor of size m, theninput
must be broadcastable with a 1-D tensor of size n andout
will be 1-D tensor of size n.alpha
andbeta
are scaling factors on matrix-vector product betweenmat
andvec
and the added tensorinput
respectively.For inputs of type FloatTensor or DoubleTensor, arguments
beta
andalpha
must be real numbers, otherwise they should be integers- Parameters
Example:
>>> M = torch.randn(2) >>> mat = torch.randn(2, 3) >>> vec = torch.randn(3) >>> torch.addmv(M, mat, vec) tensor([-0.3768, -5.5565])