0

So I wanted to do the following with two 4-dimensional arrays (a and b)

np.tensordot(a,b, axes = ([1,2,3], [0,1,2]))

But I was curious how this could be done using

np.einsum instead

kazar4
  • 77
  • 9
  • 3
    `[1,2,3], [0,1,2]` 'ijkl, jklm->im' – hpaulj Oct 09 '21 at 03:40
  • Refer to these answers for better understanding: https://stackoverflow.com/questions/26089893/understanding-numpys-einsum https://stackoverflow.com/questions/41870228/understanding-tensordot#:~:text=tensordot%20swaps%20axes%20and%20reshapes,to%20experiment%20than%20to%20explain. –  Oct 09 '21 at 06:41
  • How does this fail in the earlier numpy version. I'm not aware of recent changes in tensodot. – hpaulj Oct 09 '21 at 07:05
  • Yeah sorry this ended up being false, it seemed to be something do with my virtual environment or how TensorFlow tensors handle being given to np.tensedot (in newer version I think it converts to Numpy before being used automatically, while in older versions it does not). I will edit the question – kazar4 Oct 10 '21 at 17:04

0 Answers0