openfl.interface.aggregation_functions.core
- class openfl.interface.aggregation_functions.core.AdaptiveAggregation(*args, **kwargs)
Adaptive Federated Aggregation funtcion.
According to https://arxiv.org/abs/2003.00295
- call(local_tensors, db_iterator, tensor_name, fl_round, tags) ndarray
Aggregate tensors.
- Parameters:
local_tensors (list[openfl.utilities.LocalTensor]) – List of local tensors to aggregate.
db_iterator –
An iterator over history of all tensors. Columns: - ‘tensor_name’: name of the tensor.
Examples for `torch.nn.Module`s: ‘conv1.weight’,’fc2.bias’.
- ’fl_round’: 0-based number of round corresponding to this
tensor.
- ’tags’: tuple of tensor tags. Tags that can appear:
’model’ indicates that the tensor is a model parameter.
- ’trained’ indicates that tensor is a part of a training
result. These tensors are passed to the aggregator node after local learning.
- ’aggregated’ indicates that tensor is a result of
aggregation. These tensors are sent to collaborators for the next round.
- ’delta’ indicates that value is a difference between
rounds for a specific tensor.
also one of the tags is a collaborator name if it corresponds to a result of a local task.
’nparray’: value of the tensor.
tensor_name – name of the tensor
fl_round – round number
tags – tuple of tags for this tensor
- Returns:
np.ndarray – aggregated tensor
- class openfl.interface.aggregation_functions.core.AggregationFunction(*args, **kwargs)
Interface for specifying aggregation function.
- abstract call(local_tensors: List[LocalTensor], db_iterator: Iterator[Series], tensor_name: str, fl_round: int, tags: Tuple[str]) ndarray
Aggregate tensors.
- Parameters:
local_tensors (list[openfl.utilities.LocalTensor]) – List of local tensors to aggregate.
db_iterator –
An iterator over history of all tensors. Columns: - ‘tensor_name’: name of the tensor.
Examples for `torch.nn.Module`s: ‘conv1.weight’,’fc2.bias’.
- ’round’: 0-based number of round corresponding to this
tensor.
- ’tags’: tuple of tensor tags. Tags that can appear:
’model’ indicates that the tensor is a model parameter.
- ’trained’ indicates that tensor is a part of a training
result. These tensors are passed to the aggregator node after local learning.
- ’aggregated’ indicates that tensor is a result of
aggregation. These tensors are sent to collaborators for the next round.
- ’delta’ indicates that value is a difference between
rounds for a specific tensor.
also one of the tags is a collaborator name if it corresponds to a result of a local task.
’nparray’: value of the tensor.
tensor_name – name of the tensor
fl_round – round number
tags – tuple of tags for this tensor
- Returns:
np.ndarray – aggregated tensor
|
Adaptive aggregation module. |
|
Aggregation function interface module. |