xs = torch.randn(4, 18, 2, device='cuda')
ys = torch.randn(2, 2, device='cuda')

print((xs @ ys)[0, 0, 0])
print((xs[0, 0].unsqueeze(0) @ ys)[0, 0])
print(torch.matmul(xs, ys)[0, 0, 0])

the first and second output can be slightly different (up to 1e-4);
the device is 3090 and pytorch version is 1.7.1;
the inconsistency has not been observed on cpu.