torch.addmv#
- torch.addmv(input,mat,vec,*,beta=1,alpha=1,out=None)→Tensor#
Performs a matrix-vector product of the matrix
matandthe vectorvec.The vectorinputis added to the final result.If
matis a tensor,vecis a 1-D tensor ofsizem, theninputmust bebroadcastable with a 1-D tensor of sizen andoutwill be 1-D tensor of sizen.alphaandbetaare scaling factors on matrix-vector product betweenmatandvecand the added tensorinputrespectively.If
betais 0, then the content ofinputwill be ignored, andnan andinf init will not be propagated.For inputs of typeFloatTensor orDoubleTensor, arguments
betaandalphamust be real numbers, otherwise they should be integers.- Parameters:
- Keyword Arguments:
beta (Number,optional) – multiplier for
input()alpha (Number,optional) – multiplier for ()
out (Tensor,optional) – the output tensor.
Example:
>>>M=torch.randn(2)>>>mat=torch.randn(2,3)>>>vec=torch.randn(3)>>>torch.addmv(M,mat,vec)tensor([-0.3768, -5.5565])