Routine

ANN-SNN mode switching routine helper.

class lava.lib.dl.bootstrap.routine.LayerMode(crossover, base_mode)

Iterator that iterates layer/block’s mode of operation

Parameters:
  • crossover (int) – point below which layer is always in mode.SNN.

  • base_mode (enum) – global mode of operation. Options are mode.{SNN | ANN | SAMPLE | FIT}.

__iter__()

mode iterator

class lava.lib.dl.bootstrap.routine.Mode(value)

Enum constants for different mode of operation. Valid modes are SNN | ANN | SAMPLE | FIT.

class lava.lib.dl.bootstrap.routine.Scheduler(num_sample_iter=10, sample_period=10, crossover_epochs=None)

Hybrid mode iterator

Parameters:
  • num_sample_iter (int) – number of iteration to sample data. Defaults to 10.

  • sample_period (int) – epoch interval to initiate data sampling. Defaults to 10.

  • crossover_epochs (list) – list of ints that define crossover landmarks. None means no landmarks. Defaults to None.

mode(epoch, iteration, train=True)

Block operation mode generator.

Parameters:
  • epoch (int) – current epoch.

  • iteration (int) – current iteration.

  • train (bool) – training or evaluation mode flag. Defaults to True.

Returns:

operation mode iterator

Return type:

iterator

sync_snn_stat(stat)

Sync SNN stat.

Parameters:

stat (slayer.utils.LearningStat) – learning stat to sync.

update_snn_stat()

Update snn leraning statistics.