W is a 5×5 matrix and the items are 2×2 matrices, for example:
S0=reshape([2,2,4,4], (2, 2))
W=reshape(Any[S0 for i in 1:25],(5,5))
A is a 2×2×2 tensor, for example:
A= reshape([1,1,1,1,3,3,3,3], (2, 2, 2))
I want to sum second index of S0 in W and second index of A, I mean,
using Einsum
@einsum ans[a,b,c,d,e]:=W[a,b][c,i]*A[d,i,e]
but an error happens:
MethodError: Cannot `convert` an object of type Expr to an object of type Symbol. Is there any way to calculate this Einstein summation in Julia?