Matrix Reduction Help (Solved)

Hello, I have set of 30 xyz Cartesian coordinate points (30x3). There are 759 of these sets stacked on top of each other (759x30x3). I need to dot multiply them by another set of points so that the output is 759x30. I’ve tried torch.bmm, torch.matmul and torch.tensordot. So far, I’ve had no luck getting the correct output. Any push in the right direction would be hugely appreciated. Thanks! :slight_smile:

Either use einsum with bij,bij->bi or use unsqueeze(-2) and unsqueeze(-1) on the inputs of matmul and squeeze the result. (matmul reduces the second to last and last axes of the first and second input, respectively) or you could multiply with * and then sum at the expense of some time and memory.

1 Like