Why do torch.add and torch.einsum return different results?
t=m+n
x=torch.einsum('xyzw,xyzw-&gt;xyzw',m,n)

When I try this code, I get x that's different from t, which is surprising. Why does this happen?

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-&gt;xyzw',m,n)

is actually equivalent to
x = m * n

