config_builder#

class ConfigBuilder[source]#
abstract classmethod build_config(model: DynapcnnNetwork, chip_layers: List[int])[source]#

Build the configuration given a model

Parameters
  • model – The target model

  • chip_layers – Chip layers where the given model layers are to be mapped.

Returns

Samna Configuration object

abstract classmethod get_constraints() List[sinabs.backend.dynapcnn.mapping.LayerConstraints][source]#

Returns the layer constraints of a the given device.

Returns

List[LayerConstraints]

abstract classmethod get_default_config()[source]#
Returns

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

Returns

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

Returns

List of layer indices corresponding to each layer of the model

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

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

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 – layer index

classmethod validate_configuration(config) bool[source]#

Check if a given configuration is valid

Parameters

config – Configuration object

Returns

True if the configuration is valid, else false