Reputation: 117
t=m+n
x=torch.einsum('xyzw,xyzw->xyzw',m,n)
When I try this code, I get x
that's different from t
, which is surprising. Why does this happen?
Upvotes: 1
Views: 172
Reputation: 12597
einsum
is actually a product of its inputs. It's only a sum over the indexes that do not occur in the output.
So,
x=torch.einsum('xyzw,xyzw->xyzw',m,n)
is actually equivalent to
x = m * n
Upvotes: 2