Blocks Module

Process

Composable blocks processes in Lava.

class lava.lib.dl.netx.blocks.process.AbstractBlock(**kwargs)

Bases: AbstractProcess

Abstract block definition.

Parameters:
  • shape (tuple or list) – shape of the block output in (x, y, z) or WHC format.

  • neuron_params (dict, optional) – dictionary of neuron parameters. Defaults to None.

  • input_message_bits (int, optional) – number of message bits in input spike. Defaults to 0 meaning unary spike.

property block: str
class lava.lib.dl.netx.blocks.process.ComplexDense(**kwargs)

Bases: AbstractBlock

Dense Complex layer block.

Parameters:
  • shape (tuple or list) – shape of the layer block in (x, y, z)/WHC format.

  • neuron_params (dict, optional) – dictionary of neuron parameters. Defaults to None.

  • weight_real (np.ndarray) – synaptic real weight.

  • weight_imag (np.ndarray) – synaptic imag weight.

  • has_graded_input (dict) – flag for graded spikes at input. Defaults to False.

  • num_weight_bits_real (int) – number of real weight bits. Defaults to 8.

  • num_weight_bits_imag (int) – number of imag weight bits. Defaults to 8.

  • weight_exponent_real (int) – real weight exponent value. Defaults to 0.

  • weight_exponent_imag (int) – imag weight exponent value. Defaults to 0.

  • sparse_synapse (bool) – connection is sparse

  • input_message_bits (int, optional) – number of message bits in input spike. Defaults to 0 meaning unary spike.

export_hdf5(handle)
Return type:

None

class lava.lib.dl.netx.blocks.process.ComplexInput(**kwargs)

Bases: AbstractBlock

Input layer block.

Parameters:
  • shape (tuple or list) – shape of the layer block in (x, y, z)/WHC format.

  • neuron_params (dict, optional) – dictionary of neuron parameters. Defaults to None.

export_hdf5(handle)
Return type:

None

class lava.lib.dl.netx.blocks.process.Conv(**kwargs)

Bases: AbstractBlock

Conv layer block.

Parameters:
  • shape (tuple or list) – shape of the layer block in (x, y, z)/WHC format.

  • input_shape (tuple or list) – shape of input layer in (x, y, z)/WHC format.

  • neuron_params (dict, optional) – dictionary of neuron parameters. Defaults to None.

  • weight (np.ndarray) – kernel weight.

  • bias (np.ndarray or None) – bias of neuron. None means no bias. Defaults to None.

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

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

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

  • groups (int) – convolution groups. Defaults to 1.

  • input_message_bits (int, optional) – number of message bits in input spike. Defaults to 0 meaning unary spike.

export_hdf5(handle)
Return type:

None

class lava.lib.dl.netx.blocks.process.Dense(**kwargs)

Bases: AbstractBlock

Dense layer block. :param shape: shape of the layer block in (x, y, z)/WHC format. :type shape: tuple or list :param neuron_params: dictionary of neuron parameters. Defaults to None. :type neuron_params: dict, optional :param weight: synaptic weight. :type weight: np.ndarray :param delay: synaptic delay. :type delay: np.ndarray :param bias: bias of neuron. None means no bias. Defaults to None. :type bias: np.ndarray or None :param has_graded_input: flag for graded spikes at input. Defaults to False. :type has_graded_input: dict :param num_weight_bits: number of weight bits. Defaults to 8. :type num_weight_bits: int :param weight_exponent: weight exponent value. Defaults to 0. :type weight_exponent: int :param sparse_synapse: connection is sparse :type sparse_synapse: bool :param input_message_bits: number of message bits in input spike. Defaults to 0 meaning unary

spike.

export_hdf5(handle)
Return type:

None

class lava.lib.dl.netx.blocks.process.Input(**kwargs)

Bases: AbstractBlock

Input layer block.

Parameters:
  • shape (tuple or list) – shape of the layer block in (x, y, z)/WHC format.

  • neuron_params (dict, optional) – dictionary of neuron parameters. Defaults to None.

  • transform (fx pointer or lambda) – input transform to be applied. Defualts to lambda x: x.

  • bias (np.ndarray or None) – bias of input neuron. None means no bias. Defaults to None.

  • input_message_bits (int, optional) – number of message bits in input spike. Defaults to 0 meaning unary spike.

export_hdf5(handle)
Return type:

None

Models

class lava.lib.dl.netx.blocks.models.AbstractPyBlockModel(proc)

Bases: AbstractSubProcessModel

Abstract Block model. A block typically encapsulates at least a synapse and a neuron in a layer. It could also include recurrent connection as well as residual connection. A minimal example of a block is a feedforward layer.

required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]
tags: ty.List[str] = ['fixed_pt']
class lava.lib.dl.netx.blocks.models.PyComplexDenseModel(proc)

Bases: AbstractPyBlockModel

implements_process

alias of ComplexDense

implements_protocol

alias of LoihiProtocol

class lava.lib.dl.netx.blocks.models.PyComplexInputModel(proc)

Bases: AbstractPyBlockModel

implements_process

alias of ComplexInput

implements_protocol

alias of LoihiProtocol

class lava.lib.dl.netx.blocks.models.PyConvModel(proc)

Bases: AbstractPyBlockModel

implements_process

alias of Conv

implements_protocol

alias of LoihiProtocol

class lava.lib.dl.netx.blocks.models.PyDenseModel(proc)

Bases: AbstractPyBlockModel

implements_process

alias of Dense

implements_protocol

alias of LoihiProtocol

class lava.lib.dl.netx.blocks.models.PyInputModel(proc)

Bases: AbstractPyBlockModel

implements_process

alias of Input

implements_protocol

alias of LoihiProtocol

Module contents