@chenyuntc, what you suggest would work but it’s an elementwise multiplication. @yunjey for the dot product, in pytorch it seems to only support 2D tensors. So yes, for the moment you have to vectorize (A and B) into one vector (for instance using view, or you can also use resize for almost simpler code:
result = torch.mm(X.resize_(A*B,C), Y).resize_(A,B,D)