numpy.einsum错误:操作数的下标过多

时间:2019-05-13 12:03:49

标签: python matlab multiplication tensor numpy-einsum

我正在尝试使用einsum执行张量乘法。我正在使用MATLAB,但是正在使用python接口调用this Q&A中所述的numpy.einsum。下面是我用来执行乘法的代码:

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])) ));

但是,以上代码失败,并出现以下错误:

ValueError: einstein sum subscripts string contains too many subscripts for operand 0

0 个答案:

没有答案