config_builder#

class sinabs.backend.dynapcnn.config_builder.ConfigBuilder[source]#
abstract classmethod build_config(model: DynapcnnNetwork, chip_layers: List[int])[source]#

Build the configuration given a model.

Parameters:
  • model (DynapcnnNetwork) – The target model

  • chip_layers (List[int]) – Chip layers where the given model layers are to be mapped.

Return type:

Samna Configuration object

abstract classmethod get_constraints() List[LayerConstraints][source]#

Returns the layer constraints of a the given device.

Return type:

List[LayerConstraints]

abstract classmethod get_default_config()[source]#
Return type:

Returns the default configuration for the device type

abstract classmethod get_input_buffer()[source]#

Initialize and return the appropriate output buffer object Note that this just the buffer object.

This does not actually connect the buffer object to the graph. (It is needed as of samna 0.21.0)

abstract classmethod get_output_buffer()[source]#

Initialize and return the appropriate output buffer object Note that this just the buffer object.

This does not actually connect the buffer object to the graph.

abstract classmethod get_samna_module()[source]#

Get the saman parent module that hosts all the appropriate sub-modules and classes.

Return type:

samna module

classmethod get_valid_mapping(model: DynapcnnNetwork) List[int][source]#

Find a valid set of layers for a given model.

Parameters:
  • (DynapcnnNetwork) (model) – A model

  • model (DynapcnnNetwork)

Returns:

  • List of core indices corresponding to each layer of the model

  • The index of the core on chip to which the i-th layer in the

  • model is mapped is the value of the i-th entry in the list.

Return type:

List[int]

abstract classmethod monitor_layers(config, layers: List[int])[source]#

Enable the monitor for a given set of layers in the config object.

Parameters:

layers (List[int])

abstract classmethod reset_states(config, randomize=False)[source]#

Randomize or reset the neuron states.

Parameters:

(bool) (randomize) – If true, the states will be set to random initial values. Else they will be set to zero

classmethod set_all_v_mem_to_zeros(samna_device, layer_id: int) None[source]#

Reset all memory states to zeros.

Parameters:
  • samna_device – samna device object to erase vmem memory.

  • layer_id (int) – layer index

Return type:

None

classmethod validate_configuration(config) bool[source]#

Check if a given configuration is valid.

Parameters:

config – Configuration object

Return type:

True if the configuration is valid, else false