ptyrad.utils.common#
General purpose utility tools for logging, converting types, parsing dicts and strings, etc.
Classes
|
Functions
|
|
|
Get a value from a nested dictionary either safely (return default if not found) or stricly to fail early. |
|
Returns a formatted timestamp string based on time_format. |
Convert data to native Python or NumPy types. |
|
Detects if any GPU on the system is operating in MIG (Multi-Instance GPU) mode. |
|
|
Recursively list all keys in an HDF5 file, HDF5 group, or dict, including hierarchical paths. |
|
Recursively convert all numpy.ndarray instances in any nested structure (including lists, dicts, and tuples) into torch.Tensor on the specified device. |
|
Convert old constraint param format {freq} (pre v0.1.0b11) to {start_iter, step, end_iter}. |
|
|
|
|
|
|
|
Ensures a filepath is safe across platforms by: 1. |
|
Sets the GPU device based on the input. |
|
Set the random seeds for numpy and pytorch operations. |
|
Recursively convert all torch.Tensor instances in any nested structure (including lists, dicts, and tuples) into numpy.ndarray. |
|
Verbose print/logging with individual control, only for rank 0 in DDP. |
|