latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.addmv
- tensorplay.functional.addmv(input, mat, vec, *, beta=1, alpha=1, out=None) Tensor[source]
Performs a matrix-vector product of the matrix
matand the vectorvec. The vectorinputis added to the final result.If
matis a tensor,vecis a 1-D tensor of size m, theninputmust be broadcastable with a 1-D tensor of size n andoutwill be 1-D tensor of size n.
\text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec})alphaandbetaare scaling factors on matrix-vector product betweenmatandvecand the added tensorinputrespectively.If
betais 0, then the content ofinputwill be ignored, and nan and inf in it will not be propagated.For inputs of type FloatTensor or DoubleTensor, arguments
betaandalphamust be real numbers, otherwise they should be integers.- Parameters:
- Keyword Arguments:
beta (Number, optional) – multiplier for
input()alpha (Number, optional) – multiplier for mat @ vec ()
out (Tensor, optional) – the output tensor.
Example:
>>> M = tensorplay.randn(2) >>> mat = tensorplay.randn(2, 3) >>> vec = tensorplay.randn(3) >>> tensorplay.addmv(M, mat, vec) tensor([-0.3768, -5.5565])
Help improve this page
Found an error, an unclear step, or a missing example?

