fedn.utils.helpers.plugins package
Submodules
fedn.utils.helpers.plugins.numpyhelper module
- class fedn.utils.helpers.plugins.numpyhelper.Helper[source]
Bases:
HelperBase
FEDn helper class for models weights/parameters that can be transformed to numpy ndarrays.
- get_tmp_path(suffix='.npz')[source]
Return a temporary output path compatible with save_model, load_model.
- Parameters:
suffix – File suffix.
- Returns:
Path to file.
- load(path, file_type='npz')[source]
Load weights from file or filelike.
- Parameters:
path – file path, filehandle, filelike.
- Returns:
List of weights in numpy format.
- save(weights, path=None, file_type='npz')[source]
Serialize weights to file. The serialized model must be a single binary object.
- Parameters:
weights – List of weights in numpy format.
path – Path to file.
file_type – File type to save to. Can be ‘npz’ or ‘raw_binary’. Default is ‘npz’.
- Returns:
Path to file.