Try torch.bmm 39
N, M, V = 2, 3, 4
X = torch.rand(N, M, V)
W = torch.rand(N, V, V)

# loop implementation
res = torch.zeros(N, M, V)
for i in range(N):
    res[i, ...] = torch.matmul(X[i, ...], W[i, ...])

print(res)

# no loop implementation
res2 = torch.bmm(X, W)
print(res2)