small cleanup with timer

This commit is contained in:
Phil Wang
2022-05-20 20:05:01 -07:00
parent 022c94e443
commit 8997f178d6
3 changed files with 25 additions and 18 deletions

11
dalle2_pytorch/utils.py Normal file
View File

@@ -0,0 +1,11 @@
import time
class Timer:
def __init__(self):
self.reset()
def reset(self):
self.last_time = time.time()
def elapsed(self):
return time.time() - self.last_time