mirror of
https://github.com/lucidrains/DALLE2-pytorch.git
synced 2025-12-19 09:44:19 +01:00
small cleanup with timer
This commit is contained in:
11
dalle2_pytorch/utils.py
Normal file
11
dalle2_pytorch/utils.py
Normal 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
|
||||
Reference in New Issue
Block a user