code
1.没有cuda的版本
import time
s = time.time()
for i in range(100):
pass
t = time.time()
print("time:{} sec".format(t-s))
2.cuda 同步
torch.cuda.synchronize()
start = time.time()
result = model(input)
torch.cuda.synchronize()
end = time.time()
1.没有cuda的版本
import time
s = time.time()
for i in range(100):
pass
t = time.time()
print("time:{} sec".format(t-s))
2.cuda 同步
torch.cuda.synchronize()
start = time.time()
result = model(input)
torch.cuda.synchronize()
end = time.time()