pypose.bmv¶
- class pypose.bmv(mat, vec, *, out=None)[source]¶
Performs batched matrix-vector product.
- Parameters:
mat (
Tensor
) – matrices to be multiplied.vec (
Tensor
) – vectors to be multiplied.
- Returns:
the output tensor.
- Return type:
out (
Tensor
)
Note
The
mat
has to be a (\(\cdots\times n \times m\)) tensor, thevec
has to be a (\(\cdots\times m\)) tensor, andout
will be a (\(\cdots\times n\)) tensor. Different fromtorch.mv
, which is not broadcast, this function is broadcast and supports batched product.Example
>>> matrix = torch.randn(2, 1, 3, 2) >>> vec = torch.randn(1, 2, 2) >>> out = pp.bmv(matrix, vec) >>> out.shape torch.Size([2, 2, 3])