torch.bmm
- torch.bmm(input, mat2, *, out=None) → Tensor
Performs a batch matrix-matrix product of matrices stored in
inputand.
Performs a batch matrix-matrix product of matrices stored in input
and .
input and mat2 must be 3-D tensors each containing
the same number of matrices.
If input is a tensor, mat2 is a
tensor, out will be a
tensor.
This operator supports TensorFloat32.
On certain ROCm devices, when using float16 inputs this module will use different precision for backward.
Example:
>>> input = torch.randn(10, 3, 4)
>>> mat2 = torch.randn(10, 4, 5)
>>> res = torch.bmm(input, mat2)
>>> res.size()
torch.Size([10, 3, 5])
input (Tensor) – the first batch of matrices to be multiplied
mat2 (Tensor) – the second batch of matrices to be multiplied
out_dtype (dtype) – the dtype of the output tensor.
On CUDA and XPU, only torch.float32 is supported given
torch.float16/torch.bfloat16 input dtypes. Other backends
(including out-of-tree accelerators) may support additional
input/output dtype combinations.
out (Tensor, optional) – the output tensor.