Home:ALL Converter>tensordot equivalent of numpy-einsum

tensordot equivalent of numpy-einsum

Ask Time:2020-05-19T18:52:29         Author:Tom

Json Formatter

I am trying to figure out the tensordot equivalent of the following expression, as sparse package does not support einsum (the sparseness of the original problem is much better than the example below).

The place I am stuck with is the contraction ii->i, I don't know how to interpret this.

mki_shape=(25,25,121)
mki=np.random.uniform(size=mki_shape)
tik_shape=(10,121,25)
tik=np.random.uniform(size=tik_shape)

tim=np.einsum('mki,tik->tim',mki,tik)
print(tim.shape)

Author:Tom,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/61889264/tensordot-equivalent-of-numpy-einsum
yy