What is the difference between torch.matmul and torch.bmm?

Often times I get confused whether to use torch.matmul or go for torch.bmm I seriously don’t understand why do bmm even exist. In what cases should we use torch.matmul and in what cases should I use torch.bmm?

You can always use torch.matmul. torch.bmm is a special case of torch.matmul where both the tensors are 3-dimensional and contains equal number of matrices.

1 Like