chip_factory#

class sinabs.backend.dynapcnn.chip_factory.ChipFactory(device_str: str)[source]#
Parameters:

device_str (str)

device_id: int#
device_name: str#
events_to_raster(events: List, dt: float = 0.001, shape: Tuple | None = None) Tensor[source]#

Convert events from DynapcnnNetworks to spike raster Note: Timestamp of first event will be considered as start time.

Parameters:
  • events (List[Spike]) – A list of events that will be streamed to the device

  • dt (float) – Length of each time step for rasterization (in seconds)

  • shape (Optional[Tuple]) – Shape of the raster to be produced, excluding the time dimension. (Channel, Height, Width) If this is not specified, the shape is inferred based on the max values found in the events.

Returns:

raster – A 4 dimensional tensor of spike events with the dimensions [Time, Channel, Height, Width]

Return type:

torch.Tensor

get_config_builder() ConfigBuilder[source]#
Return type:

ConfigBuilder

raster_to_events(raster: Tensor, layer, dt=0.001, truncate: bool = False, delay_factor: float = 0) List[source]#

Convert spike raster to events for DynapcnnNetworks.

Parameters:
  • raster (torch.Tensor) – A 4 dimensional tensor of spike events with the dimensions [Time, Channel, Height, Width]

  • layer (int) – The index of the layer to route the events to

  • dt (float) – Length of time step of the raster in seconds

  • truncate (bool) – (default = False) Limit time-bins with more than one spikes to one spike.

  • delay_factor (float) – (default = 0) Start simulation from this time. (in seconds)

Returns:

events – A list of events that will be streamed to the device

Return type:

List[Spike]

supported_devices = {'dynapcnndevkit': <class 'sinabs.backend.dynapcnn.chips.dynapcnn.DynapcnnConfigBuilder'>, 'speck2b': <class 'sinabs.backend.dynapcnn.chips.speck2b.Speck2BConfigBuilder'>, 'speck2btiny': <class 'sinabs.backend.dynapcnn.chips.speck2b.Speck2BConfigBuilder'>, 'speck2cmini': <class 'sinabs.backend.dynapcnn.chips.speck2cmini.Speck2CMiniConfigBuilder'>, 'speck2dmini': <class 'sinabs.backend.dynapcnn.chips.speck2dmini.Speck2DMiniConfigBuilder'>, 'speck2e': <class 'sinabs.backend.dynapcnn.chips.speck2e.Speck2EConfigBuilder'>, 'speck2edevkit': <class 'sinabs.backend.dynapcnn.chips.speck2e.Speck2EConfigBuilder'>, 'speck2fdevkit': <class 'sinabs.backend.dynapcnn.chips.speck2f.Speck2FConfigBuilder'>, 'speck2fmodule': <class 'sinabs.backend.dynapcnn.chips.speck2f.Speck2FConfigBuilder'>}#
xytp_to_events(xytp: ndarray, layer, reset_timestamps, delay_factor: float = 0) List[source]#

Convert series of spikes in a structured array (eg. from aermanager) to events for DynaapcnnDevKit.

Parameters:
  • xytp (torch.Tensor) – A numpy structured array with columns x, y, t(timestamp), p(polarity)

  • layer (int) – The index of the layer to route the events to

  • reset_timestamps (Boolean) – If set to True, timestamps will be aligned to start from 0

  • delay_factor (float) – (default = 0) Start simulation from this time. (in seconds)

Returns:

events – A list of events that will be streamed to the device

Return type:

List[Spike]