Spaces:
Runtime error
Runtime error
fix timer cuda
Browse files- 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=
|
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)
|