Article Directory
Function introduction
torch.bmm(input, mat2, *, out=None) → Tensor
-
enter:
-
Function to perform batch matrix multiplication between
input
andmat2
-
input
Bothmat2
must be 3-D tensors, they contain the same number of matrices-
If is a tensor
input
of shape[b, n, m]
-
mat2
is[b, m, p]
a tensor of shape -
Then the result of the function is the tensor
shape
of[b, n, p]
-
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])