config_builder#

class sinabs.backend.dynapcnn.config_builder.ConfigBuilder[source]#
abstractmethod classmethod build_config(layers: Dict[int, DynapcnnLayer], layer2core_map: Dict[int, int], destination_map: Dict[int, List[int]])[source]#

Build the configuration given a model.

Parameters:
  • layers (Dict) – Keys are layer indices, values are DynapcnnLayer instances.

  • layer2core_map (Dict) – Keys are layer indices, values are corresponding cores on hardware. Needed to map the destinations.

  • destination_map (Dict) – Indices of destination layers for layer.

Returns:

Samna Configuration object

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

Returns the layer constraints of a the given device.

Returns:

List[LayerConstraints]

Return type:

List[LayerConstraints]

abstractmethod classmethod get_default_config()[source]#
Returns:

Default configuration for the device type

abstractmethod 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)

abstractmethod 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.

abstractmethod classmethod get_samna_module()[source]#

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

Returns:

samna module

classmethod map_layers_to_cores(layers: Dict[int, DynapcnnLayer]) Dict[int, int][source]#

Find a mapping from DynapcnnLayers onto on-chip cores

Parameters:

layers (Dict[int, DynapcnnLayer]) – Dict with layer indices as keys and DynapcnnLayer instances as values.

Returns:

Dict mapping layer indices (keys) to assigned core IDs (values).

Return type:

Dict[int, int]

abstractmethod 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])

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

Randomize or reset the neuron states.

Parameters:

randomize (bool) – 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.

Returns:

True if the configuration is valid, else false

Return type:

bool