I want to multiply two tensors so that the first dimension is kept but every 6 elements of a[:] are element-wise scalar-multiplied with its associated elements in b so that the resulting tensor c is of shape [1,3,2]. I tried to use torch.dot, and other methods and ended up using Einsteins sum convention, but I still cant seem to get it right
a = torch.ones(3,3,2)
print("a", a.shape)
b = torch.ones(3,1,1)
print("b", b.shape)
c = torch.einsum('bij,bkl->ij', a, b)
print("c", c.shape)
Help is appreciated