vict0rsch commited on
Commit
9a7001e
1 Parent(s): 7ef76f3

fix timer cuda

Browse files
Files changed (1) hide show
  1. climategan/utils.py +2 -2
climategan/utils.py CHANGED
@@ -917,12 +917,12 @@ def all_texts_to_array(texts, width=640, height=40):
917
 
918
 
919
  class Timer:
920
- def __init__(self, name="", store=None, precision=3, ignore=False, cuda=True):
921
  self.name = name
922
  self.store = store
923
  self.precision = precision
924
  self.ignore = ignore
925
- self.cuda = cuda
926
 
927
  if cuda:
928
  self._start_event = torch.cuda.Event(enable_timing=True)
 
917
 
918
 
919
  class Timer:
920
+ def __init__(self, name="", store=None, precision=3, ignore=False, cuda=None):
921
  self.name = name
922
  self.store = store
923
  self.precision = precision
924
  self.ignore = ignore
925
+ self.cuda = cuda or torch.cuda.is_available()
926
 
927
  if cuda:
928
  self._start_event = torch.cuda.Event(enable_timing=True)