aihwkit.experiments.experiments.base module

Base class for an Experiment.

class aihwkit.experiments.experiments.base.Experiment[source]

Bases: object

Base class for an Experiment.

This class is used as the base class for more specific experiments. The experiments use hooks for reporting the different status changes to the Metrics during the execution of the experiment.

add_hook(key, hook)[source]

Register a hook for the experiment.

Register a new hook for a particular signal. During the execution of the experiment, the hook function will be called.

Parameters:
  • key (Signals) – signal which the hook will be registered to.

  • hook (Callable) – a function that will be called when the signal is emitted.

Return type:

None

clear_hooks()[source]

Remove all the hooks from the experiment.

Return type:

None

class aihwkit.experiments.experiments.base.Signals(value)[source]

Bases: Enum

Signals emitted by an Experiment.

EPOCH_END = 11
EPOCH_START = 10
EXPERIMENT_END = 2
EXPERIMENT_START = 1
INFERENCE_END = 41
INFERENCE_REPEAT_END = 51
INFERENCE_REPEAT_START = 50
INFERENCE_START = 40
TRAIN_EPOCH_BATCH_END = 23
TRAIN_EPOCH_BATCH_START = 22
TRAIN_EPOCH_END = 21
TRAIN_EPOCH_START = 20
VALIDATION_EPOCH_BATCH_END = 33
VALIDATION_EPOCH_BATCH_START = 32
VALIDATION_EPOCH_END = 31
VALIDATION_EPOCH_START = 30