mindspore.ops.addmv
- mindspore.ops.addmv(input, mat, vec, *, beta=1, alpha=1)[source]
Multiply the matrix mat and vector vec , and then add the result to the input .
Note
If mat is a \((N, M)\) tensor, vec is a 1-D tensor of size \(M\), then input must be broadcastable with a 1-D tensor of size \(N\), out will be a 1-D tensor of size \(N\).
If beta is 0, input will be ignored.
\[output = β input + α (mat @ vec)\]- Parameters
- Keyword Arguments
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> input = mindspore.tensor([2., 3.]) >>> mat = mindspore.tensor([[2., 5., 3.], [4., 2., 2.]]) >>> vec = mindspore.tensor([3., 2., 4.]) >>> output = mindspore.ops.addmv(input, mat, vec) >>> print(output) [30. 27.]