In numpy, when i have a 3D tensor  X with shape [A, B, C] and a 2D tensor Y with shape [C, D], then np.dot(X, Y) gives a 3D tensor with shape [A, B, D].
In PyTorch, i can do this as below.
result = torch.mm(X.view(-1, C), Y)
result = result.view(-1, B, D)

Is there simpler way to handle this?