Basically, I have 2 tensors: A, where A.shape = (N, H, D) and B, where B.shape = (K, H, D) . What I would like to do is get the tensor C with the form (N, K, D, H) such that:
C[i, j, :, :] = A[i, :, :] * B[j, :, :].
Can this be done efficiently in Theano?
Side note: the actual end result that I would like to achieve is to have an E-shaped tensor (N, K, D) such that:
E[i, j, :] = (A[i, :, :]*B[j, :, :]).sum(0)
So, if there is a way to get it straight, I would prefer it (saves space, I hope).