Sorry for late reply.
But how can I change bmm to matmul?
I have two matrix A(batch_size, 300) and B(batch_size, 300), I want to do row-wise dot product. In numpy I can use einsum api to achieve this. In Pytorch only thing I know is bmm with unsequeeze.
Another way is A*B.T and then get values setting on the diagonal.