As in the PyTorch document,

image1044×348 26.2 KB

torch.bmm should be used when both input are batched matrixes.
But it seems like you are doing multiplication with a batch of vector by a constant matrix.
If you really want to use bmm, you can make both of your inputs be the right format like the following.
import torch
M, N, B = 10, 12, 14
x = torch.rand(M, N)
y = torch.rand(N, B)

x_batch = x.repeat(B, 1, 1) # make x_batch be the shape of (B, M, N)
y_batch = y.T.unsqueeze(2) # make y_batch be the shape of (B, N, 1)
results = torch.bmm(x_batch, y_batch)