Add utils
This commit is contained in:
parent
d904350a2c
commit
5e644b912e
20
cacheflow/utils.py
Normal file
20
cacheflow/utils.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
class Device(enum.Enum):
|
||||||
|
GPU = enum.auto()
|
||||||
|
CPU = enum.auto()
|
||||||
|
|
||||||
|
|
||||||
|
class Counter:
|
||||||
|
|
||||||
|
def __init__(self, start: int = 0) -> None:
|
||||||
|
self.counter = start
|
||||||
|
|
||||||
|
def next(self) -> int:
|
||||||
|
id = self.counter
|
||||||
|
self.counter += 1
|
||||||
|
return id
|
||||||
|
|
||||||
|
def reset(self) -> None:
|
||||||
|
self.counter = 0
|
||||||
Loading…
Reference in New Issue
Block a user