I have two arrays A=[1,2,3]
and B=[[1],[0],[1],[0]]
. The question how to perform their tensor dot product in python. I am expecting to get:
C=[[1,2,3],
[0,0,0],
[1,2,3],
[0,0,0]]
The function np.tensordot() returns an error concerning shapes of arrays.
A little addition to this question. How to do such operation if matrix are totally different in shape, like:
A=[[1,1,1,1],
[1,1,1,1],
[2,2,2,2],
[3,3,3,3]]
B=[2,1]
C=[[[2,1],[2,1],[2,1],[2,1]],
[[2,1],[2,1],[2,1],[2,1]],
[[4,2],[4,2],[4,2],[4,2]],
[[6,3],[6,3],[6,3],[6,3]]]