I have the following four tensors
- H (h, r)
- A (a, r)
- D (d, r)
- T (a, t, r)
For each i in a there exists a corresponding T[i] form (t, r) .
I need to do np.einsum to get the following result ( pred ):
pred = np.einsum('hr, ar, dr, tr ->hadt', H, A, D, T[0]) for i in range(a): pred[:, i:i+1, :, :] = np.einsum('hr, ar, dr, tr ->HADT', H, A[i:i+1], D, T[i])
However, I want to do this calculation without using a for loop. The reason is because I use autograd , which currently does not work with element assignment!
source share