fl4health.parameter_exchange.layer_exchanger module¶
- class DynamicLayerExchanger(layer_selection_function)[source]¶
Bases:
PartialParameterExchanger
[list
[str
]]- __init__(layer_selection_function)[source]¶
This exchanger uses “layer_selection_function” to select a subset of a model’s layers at the end of each training round. Only the selected layers are exchanged with the server. :type layer_selection_function:
Callable
[[Module
,Module
|None
],tuple
[List
[ndarray
[Any
,dtype
[Any
]]],list
[str
]]] :param layer_selection_function: Function responsible for selecting the layers to be exchanged. This function relieson extra parameters such as norm threshold or exchange percentage, but we assume that it has already been pre-constructed using the class LayerSelectionFunctionConstructor, so it only needs to take in two nn.Module objects as inputs. For more details, please see the docstring of LayerSelectionFunctionConstructor.
- class FixedLayerExchanger(layers_to_transfer)[source]¶
Bases:
ParameterExchanger
- class LayerExchangerWithExclusions(model, module_exclusions)[source]¶
Bases:
ParameterExchanger
This class implements exchanging all model layers except those matching a specified set of types. The constructor is provided with the model in order to extract the proper layers to be exchanged based on the exclusion criteria