m = 998
n = 2473
a = torch.randn(m*n).cuda()
st = time.time()
r = torch.dot(a,a)
ed = time.time()
print(ed - st)
this will output 0.09s
st = time.time()
r = torch.dot(a,a)
ed = time.time()
print(ed - st)
This will output 0.0001. This is 100x times faster. What’s the reason? I am on Ubuntu 16.04, pytorch 0.3, cuda 9.