fl4health.parameter_exchange.parameter_packer module¶
- class ParameterPacker[source]¶
- class ParameterPackerAdaptiveConstraint[source]¶
Bases:
ParameterPacker
[float
]
- class ParameterPackerWithClippingBit[source]¶
Bases:
ParameterPacker
[float
]
- class ParameterPackerWithControlVariates(size_of_model_params)[source]¶
Bases:
ParameterPacker
[List
[ndarray
[Any
,dtype
[Any
]]]]
- class ParameterPackerWithLayerNames[source]¶
Bases:
ParameterPacker
[list
[str
]]
- class SparseCooParameterPacker[source]¶
Bases:
ParameterPacker
[tuple
[List
[ndarray
[Any
,dtype
[Any
]]],List
[ndarray
[Any
,dtype
[Any
]]],list
[str
]]]This parameter packer is responsible for selecting an arbitrary set of parameters and then representing them in the sparse COO tensor format, which requires knowing the indices of the parameters within the tensor to which they belong, the shape of that tensor, and also the name of it.
For more information on the sparse COO format and sparse tensors in PyTorch, please see the following two pages:
- static extract_coo_info_from_dense(x)[source]¶
Take a dense tensor x and extract the information required (namely, its nonzero values, their indices within the tensor, and the shape of x) in order to represent it in the sparse coo format.
The results are converted to numpy arrays.
- Parameters:
x (Tensor) – Input dense tensor.
- Returns:
The nonzero values of x, the indices of those values within x, and the shape of x.
- Return type:
tuple[NDArray, NDArray, NDArray]