save_dict_to_hdf5#
- ptyrad.save.save_dict_to_hdf5(d, output_path, none_sentinel='__NONE__', **kwargs)[source]#
Save a nested Python dictionary to an HDF5 file.
Supports common Python, NumPy, and PyTorch types. Non-HDF5-compatible types (e.g., list of tuples, None, etc.) are automatically converted to HDF5-friendly formats.
Note that integer key (e.g. like in optimizer state dict) are coerced to string for HDF5 format.
- Parameters:
d (Dict[str, Any]) – The nested dictionary to save.
output_path (str) – The file path to save the HDF5 output to.
none_sentinel (str, optional) – String used to represent None in HDF5. Defaults to “__NONE__”.
**kwargs – Additional keyword arguments to pass to h5py.File() or create_dataset(). This can include compression settings like compression=”gzip”, etc.
- Returns:
None
- Return type:
None