HDF5

HDF5 network exchange module.

class lava.lib.dl.netx.hdf5.Network(net_config, num_layers=None, skip_layers=0, input_message_bits=0, input_shape=None, reset_interval=None, reset_offset=0)

Generates a Lava process for the network described in hdf5 config.

Parameters
  • net_config (str) – name of the hdf5 config filename.

  • num_layers (int, optional) – number of blocks to generate. An integer value will only generate the first num_layers blocks in the description. The actual number of generated layers may be less than num_layers. If it is None, all the layers are generated. Defaults to None.

  • skip_layers (int) – number of blocks to skip. The nework generator will skip the first skip_layers blocks that have been generated accoridng to num_layers parametr. If it is None, no layers are skipped. Defaults to None.

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

  • input_shape (tuple of ints, optional) – shape of input to the network. If None, input layer is assumed to be the first layer. Defaults to None.

  • reset_interval (int, optional) – determines how often the network needs to be reset. Reset is orchestrated with a timestep offset as per the layer number. If that is not desired, it can be changed by directly accessing the layer’s neuron’s reset parameter. None means no reset. Defaults to None.

  • reset_offset (int) – determines the phase shift of network reset if enabled. Defaults to 0.

__len__()

Number of layers in the network.

Return type

int

__str__()

Network description string.

Return type

str

static create_conv(layer_config, input_shape, input_message_bits=0, reset_interval=None, reset_offset=0)

Creates conv layer from layer configuration

Parameters
  • layer_config (h5py.Group) – hdf5 handle to layer description.

  • input_shape (tuple of 3 ints) – shape of input to the block.

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

  • reset_interval (int, optional) – the reset interval. None means no reset. Default is None.

  • reset_offset (int) – the offset/phase of reset. It is only valid of reset_interval is not None.

Return type

Tuple[Conv, str]

Returns

  • AbstractProcess – dense block process.

  • str – table entry string for process.

static create_dense(layer_config, input_message_bits=0, reset_interval=None, reset_offset=0)

Creates dense layer from layer configuration

Parameters
  • layer_config (h5py.Group) – hdf5 handle to layer description.

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

  • reset_interval (int, optional) – the reset interval. None means no reset. Default is None.

  • reset_offset (int) – the offset/phase of reset. It is only valid of reset_interval is not None.

Return type

Tuple[Dense, str]

Returns

  • AbstractProcess – dense block process.

  • str – table entry string for process.

static create_input(layer_config, reset_interval=None, reset_offset=0)

Creates input layer from layer configuration.

Parameters
  • layer_config (h5py.Group) – hdf5 handle to layer description.

  • reset_interval (int, optional) – the reset interval. None means no reset. Default is None.

  • reset_offset (int) – the offset/phase of reset. It is only valid of reset_interval is not None.

Return type

Tuple[Input, str]

Returns

  • AbstractProcess – input block process.

  • str – table entry string for process.

static get_neuron_params(neuron_config, input=False, reset_interval=None, reset_offset=0)

Provides the correct neuron configuration process and parameters from the neuron description in hdf5 config.

Parameters
  • neuron_config (h5py.Group) – hdf5 object describing the neuron configuration

  • input (bool) – flag to indicate if the layer is input. For some cases special processing may be done.

  • reset_interval (int, optional) – the reset interval. None means no reset. Default is None.

  • reset_offset (int) – the offset/phase of reset. It is only valid of reset_interval is not None.

Returns

The Lava process that implements the neuron described.

Return type

AbstractProcess

class lava.lib.dl.netx.hdf5.PyNetworkModel(proc)
implements_process

alias of Network

implements_protocol

alias of LoihiProtocol