Shortcuts

torch.mv

torch.mv(input, vec, out=None) → Tensor

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

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

Note

This function does not broadcast.

Parameters
  • input (Tensor) – matrix to be multiplied

  • vec (Tensor) – vector to be multiplied

  • out (Tensor, optional) – the output tensor.

Example:

>>> mat = torch.randn(2, 3)
>>> vec = torch.randn(3)
>>> torch.mv(mat, vec)
tensor([ 1.0404, -0.6361])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources