Given there is torch.matmul, which can also do a 3d matrix multiplication, why does torch.bmm exist?
torch..matmul
would be the more flexible op allowing for inputs using different shapes as described in the docs and would broadcast the tensors if needed.
torch.bmm
expects two 3D tensors and will not broadcast them as noted in the docs. I would claim standard use cases should call into torch.matmul
and benefit from the flexibility.