mindspore.ops.mv
- mindspore.ops.mv(mat, vec)[source]
Multiplies matrix mat and vector vec.
If mat is a Tensor with \((N, M)\), vec is a 1-D Tensor of size \(M\), out will be 1-D of size \(N\).
- Parameters
- Returns
Tensor, the shape of the output Tensor is \((N,)\).
- Raises
TypeError – If mat or vec is not a Tensor.
ValueError – If mat is not a 2-D Tensor or vec is not a 1-D Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> mat = Tensor(np.array([[3., 4.], [1., 6.], [1., 3.]]).astype(np.float32)) >>> vec = Tensor(np.array([1., 2.]).astype(np.float32)) >>> output = ops.mv(mat, vec) >>> print(output) [11. 13. 7.]