l2gv2 package#

Subpackages#

Submodules#

l2gv2.example module#

l2gv2.utils module#

TODO: module docstring for utils.py

class l2gv2.utils.EarlyStopping(patience: int, delta: float = 0)#

Bases: object

Context manager for early stopping

class l2gv2.utils.Timer#

Bases: object

Context manager for accumulating execution time

Adds the time taken within block to a running total.

l2gv2.utils.ensure_extension(filename: str, extension: str) Path#

Check filename for extension and add it if necessary

Parameters:
  • filename – input filename

  • extension – desired extension (including .)

Returns:

Path object with correct extension

Raises:

ValueError – if filename has the wrong extension

l2gv2.utils.flatten(lst, ltypes=(<class 'list'>, <class 'tuple'>))#

TODO: docstring for flatten.

l2gv2.utils.get_device(model: Module) device#

TODO: docstring for get_device.

l2gv2.utils.set_device(device: str | None = None)#

TODO: docstring for set_device.

l2gv2.utils.speye(n: int, dtype: dtype = torch.float32) Tensor#

identity matrix of dimension n as sparse_coo_tensor.

l2gv2.utils.tqdm_close(t: tqdm)#

Module contents#