[Solved] How to perform multiplication along axes in pytorch?

[ad_1]

Your most versatile function for matrix multiplication is torch.einsum: it allows you specify the dimensions along which to multiply and the order of the dimensions of the output tensor.
In your case it would look like:

dot_product = torch.einsum('bij,bj->bi')

[ad_2]

solved How to perform multiplication along axes in pytorch?