Block Module

Abstract Block

Abstract bootstrap layer blocks.

class lava.lib.dl.bootstrap.block.base.AbstractBlock(*args, **kwargs)

Bases: Module

Abstract bootstrap block

fit()

Fit the sampling points to estimate piecewise linear model.

forward(x, mode=Mode.ANN)

Forward calculation block

Parameters:
  • x (torch tensor) – input tensor.

  • mode (optional) – forward operation mode. Can be one of Mode.SNN` | `Mode.ANN` | `Mode.SAMPLE. Defaults to Mode.ANN.

Returns:

output tensor.

Return type:

torch tensor

lava.lib.dl.bootstrap.block.base.doc_modifier(doc)

CUrrent BAsed Leaky Integrate and Fire (CUBA) Block

Bootstrap CUBA layer blocks.

class lava.lib.dl.bootstrap.block.cuba.Affine(*args, **kwargs)

Bases: Affine, AbstractBlock

CUBA LIF affine transform class. This should never be instantiated on its own.

Parameters:
  • neuron_params (dict, optional) – a dictionary of CUBA LIF neuron parameter. Defaults to None.

  • in_neurons (int) – number of input neurons.

  • out_neurons (int) – number of output neurons.

  • weight_scale (int, optional) – weight initialization scaling. Defaults to 1.

  • weight_norm (bool, optional) – flag to enable weight normalization. Defaults to False.

  • pre_hook_fx (optional) – a function pointer or lambda that is applied to synaptic weights before synaptic operation. None means no transformation. Defaults to None.

  • dynamics (bool, optional) – flag to enable neuron dynamics. If False, only the dendrite current is returned. Defaults to True.

  • mask (bool array, optional) – boolean synapse mask that only enables relevant synapses. None means no masking is applied. Defaults to None.

  • count_log (bool, optional) – flag to return event count log. If True, an additional value of average event rate is returned. Defaults to False.

fit()

Fit the sampling points to estimate piecewise linear model.

forward(x, mode=Mode.ANN)

Forward computation method. The input can be either of NCT or NCHWT format.

class lava.lib.dl.bootstrap.block.cuba.Conv(*args, **kwargs)

Bases: Conv, AbstractBlock

CUBA LIF convolution block class. This should never be instantiated on its own.

Parameters:
  • neuron_params (dict, optional) – a dictionary of CUBA LIF neuron parameter. Defaults to None.

  • in_features (int) – number of input features.

  • out_features (int) – number of output features.

  • kernel_size (int) – kernel size.

  • stride (int or tuple of two ints, optional) – convolution stride. Defaults to 1.

  • padding (int or tuple of two ints, optional) – convolution padding. Defaults to 0.

  • dilation (int or tuple of two ints, optional) – convolution dilation. Defaults to 1.

  • groups (int, optional) – number of blocked connections. Defaults to 1.

  • weight_scale (int, optional) – weight initialization scaling. Defaults to 1.

  • weight_norm (bool, optional) – flag to enable weight normalization. Defaults to False.

  • pre_hook_fx (optional) – a function pointer or lambda that is applied to synaptic weights before synaptic operation. None means no transformation. Defaults to None.

  • delay (bool, optional) – flag to enable axonal delay. Defaults to False.

  • delay_shift (bool, optional) – flag to simulate spike propagation delay from one layer to next. Defaults to True.

  • count_log (bool, optional) – flag to return event count log. If True, an additional value of average event rate is returned. Defaults to False.

forward(x, mode=Mode.ANN)
class lava.lib.dl.bootstrap.block.cuba.Dense(*args, **kwargs)

Bases: Dense, AbstractBlock

CUBA LIF dense block class. The block is 8 bit quantization ready.

Parameters:
  • neuron_params (dict, optional) – a dictionary of CUBA LIF neuron parameter. Defaults to None.

  • in_neurons (int) – number of input neurons.

  • out_neurons (int) – number of output neurons.

  • weight_scale (int, optional) – weight initialization scaling. Defaults to 1.

  • weight_norm (bool, optional) – flag to enable weight normalization. Defaults to False.

  • pre_hook_fx (optional) – a function pointer or lambda that is applied to synaptic weights before synaptic operation. None means no transformation. Defaults to None.

  • delay (bool, optional) – flag to enable axonal delay. Defaults to False.

  • delay_shift (bool, optional) – flag to simulate spike propagation delay from one layer to next. Defaults to True.

  • mask (bool array, optional) – boolean synapse mask that only enables relevant synapses. None means no masking is applied. Defaults to None.

  • count_log (bool, optional) – flag to return event count log. If True, an additional value of average event rate is returned. Defaults to False.

forward(x, mode=Mode.ANN)
class lava.lib.dl.bootstrap.block.cuba.Flatten(*args, **kwargs)

Bases: Flatten, AbstractBlock

CUBA LIF flatten block class. This should never be instantiated on its own.

Parameters:

count_log (bool, optional) – flag to return event count log. If True, an additional value of average event rate is returned. Defaults to False.

forward(x, mode=Mode.ANN)

Forward computation method. The input can be either of NCT or NCHWT format.

class lava.lib.dl.bootstrap.block.cuba.Input(*args, **kwargs)

Bases: Input, AbstractBlock

CUBA LIF input block class. The block is 8 bit quantization ready.

Parameters:
  • neuron_params (dict, optional) – a dictionary of CUBA LIF neuron parameter. Defaults to None.

  • weight (float, optional) – weight for affine transform of input. None means no weight scaling. Defaults to None.

  • bias (float, optional) – bias for affine transform of input. None means no bias shift. Defaults to None.

  • delay_shift (bool, optional) – flag to simulate spike propagation delay from one layer to next. Defaults to True.

  • count_log (bool, optional) – flag to return event count log. If True, an additional value of average event rate is returned. Defaults to False.

forward(x, mode=Mode.ANN)

Module contents