pytorch中的math operation: torch.bmm()
torch.bmm(batch1, batch2, out=None) → Tensor
Performs a batch matrix-matrix product of matrices stored in batch1 and batch2.
batch1 and batch2 must be 3-D tensors each containing the same number of matrices.
If batch1 is a (b×n×m)tensor, batch2 is a (b×m×p) tensor, out will be a (b×n×p)tensor.
outi=batch1i@batch2i outi=batch1i@batch2i
Note
This function does not broadcast. For broadcasting matrix products, see torch.matmul().
| Parameters: |
|---|
Example:
>>> batch1 = torch.randn(10, 3, 4)
>>> batch2 = torch.randn(10, 4, 5)
>>> res = torch.bmm(batch1, batch2)
>>> res.size()
torch.Size([10, 3, 5])
越努力,越幸运

浙公网安备 33010602011771号