Hi Yang!



 optyang:

which of these two methods is faster and which has a smaller memory consumption?


I don’t know which approach would be more efficient.  (I’ve never tested it.)
I could see torch.einsum() having a little extra overhead because it has
to parse the 'ijkl, im -> ijkl' string.  It could also be (maybe in certain
situations) significantly less efficient if its generality prevents it from performing
the tensor multiplications in the most optimal way.  But maybe it’s smart
enough to figure out the optimal approach.
Best.
K. Frank