I’m trying to implement an attention model,  but fail to execute the matmul
torch.matmul(att, v)

The shape of att and v is:
att shape:torch.Size([20, 3, 128, 128])
v shape:torch.Size([20, 3, 128, 100])

i get such an error:

RuntimeError: Expected tensor to have size 100 at dimension 1, but got size 128 for argument #2 ‘batch2’ (while checking arguments for bmm)

I also tried generate two tensors with the same shape by torch.randn and repeat the same operation and no error ouccrred. I don’t know what makes such an error.