This commit is contained in:
Glenn Jocher
2020-03-04 10:26:35 -08:00
parent 35eae3ace9
commit 1430a1e408
2 changed files with 11 additions and 5 deletions
+6
View File
@@ -1,4 +1,5 @@
import os
import time
import torch
import torch.backends.cudnn as cudnn
@@ -40,6 +41,11 @@ def select_device(device='', apex=False, batch_size=None):
return torch.device('cuda:0' if cuda else 'cpu')
def time_synchronized():
torch.cuda.synchronize() if torch.cuda.is_available() else None
return time.time()
def fuse_conv_and_bn(conv, bn):
# https://tehnokv.com/posts/fusing-batchnorm-and-conv/
with torch.no_grad():