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
tensor, vec is a 1-D tensor of size , then input must be broadcastable with a 1-D tensor of size , out will be a 1-D tensor of size .If beta is 0, input will be ignored.
- 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.]