openfl.callbacks.LambdaCallback

openfl.callbacks.LambdaCallback#

class openfl.callbacks.LambdaCallback(on_round_begin=None, on_round_end=None, on_task_begin=None, on_task_end=None, on_experiment_begin=None, on_experiment_end=None)[source]#

Custom on-the-fly callbacks.

This callback can be constructed with functions that will be called at the appropriate time during the life-cycle of a Federated Learning experiment. Certain callbacks may expect positional arguments, for example:

  • on_round_begin: expects round_num as a positional argument.

  • on_round_end: expects round_num as a positional argument.

  • on_task_begin: expects task_name and round_num as a positional argument.

  • on_task_end: expects task_name and round_num as a positional argument.

Parameters:
  • on_round_begin – called at the beginning of every round.

  • on_round_end – called at the end of every round.

  • on_task_begin – called at the beginning of a task.

  • on_task_end – called at the end of a task.

  • on_experiment_begin – called at the beginning of an experiment.

  • on_experiment_end – called at the end of an experiment.

__init__(on_round_begin=None, on_round_end=None, on_task_begin=None, on_task_end=None, on_experiment_begin=None, on_experiment_end=None)[source]#

Methods

__init__([on_round_begin, on_round_end, ...])

on_experiment_begin([logs])

Callback function to be executed at the beginning of an experiment.

on_experiment_end([logs])

Callback function to be executed at the end of an experiment.

on_round_begin(round_num[, logs])

Callback function to be executed at the beginning of a round.

on_round_end(round_num[, logs])

Callback function to be executed at the end of a round.

on_task_begin(task_name, round_num[, logs])

Callback function to be executed at the beginning of a task.

on_task_end(task_name, round_num[, logs])

Callback function to be executed at the end of a task.

set_params(params)

set_tensor_db(tensor_db)