oneflow.mv

oneflow.mv(input, vec)Tensor

Performs a matrix-vector product of the matrix input and the vector vec.

If input is a \((n \times m)\) tensor, vec is a 1-D tensor of size m, out will be a 1-D tensor of size n.

Note

This function does not broadcast.

The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.mv.html.

Parameters
Returns

the output Tensor

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> mat = flow.randn(2, 3)
>>> vec = flow.randn(3)
>>> out = flow.mv(mat, vec)
>>> out.shape
oneflow.Size([2])