I have a tensor of shape 4x64x300 and i need to find the dot product of all of the four 64x300 matrices to get a 64x300 matrix. What is the most efficient way to do this?

You can use `torch.prod(inp, dim=0)`

(doc here). It is like sum but does a product instead of addition.

1 Like