multigeom.utils#
Shared utilities: RNG seeding, provenance records, device selection, a progress line and showing a figure in a notebook. Configuration loading and project paths are in multigeom.config.
Functions
|
Return (trainable, total) parameter counts. |
|
PNG bytes of a matplotlib figure, independent of the matplotlib backend in use. |
|
Resolve a torch.device, preferring CUDA when available. |
|
A torch.Generator on device, seeded with seed. |
|
Record what produced an output: git commit (and whether the tree was dirty), command line, seed, config file contents, and package versions. |
|
Seed Python's and torch's global generators (CPU + CUDA). |
|
Display a figure in a notebook as an image. |
|
The environment for a child process that runs python -m multigeom...: this package is importable in it even if it is not installed (a source checkout), and extra is added. |
Classes
|
A one-line progress bar that is updated in place: in a notebook through display(..., display_id=True) (no ipywidgets needed, no extra lines), in a terminal with a carriage return. |