2

I am trying to use einsum to perform tensor multiplication. I am working in MATLAB, but am using the python interface to call numpy.einsum as described in this Q&A. Below is the code I'm using to perform the multiplication:

np = py.importlib.import_module('numpy');
ndim = 3; i = eye(ndim);
I = np.einsum('il,jk',matpy.mat2nparray(i),matpy.mat2nparray(i));
I4 = matpy.nparray2mat(...
  np.einsum('ijxyz,klxyz -> ijklxyz', I, matpy.mat2nparray(ones([30,30,30])) ));

However, the above code fails with the following error:

ValueError: einstein sum subscripts string contains too many subscripts for operand 0
Dev-iL
  • 23,742
  • 7
  • 57
  • 99
fenfam
  • 63
  • 2
  • 9

0 Answers0