chip_factory
chip_factory#
- class ChipFactory(device_str: str)[source]#
Factory class to access config builder and other device specific methods
- Parameters
device_str –
- device_id: int#
- device_name: str#
- events_to_raster(events: List, dt: float = 0.001, shape: Optional[Tuple] = None) torch.Tensor [source]#
Convert events from DynapcnnNetworks to spike raster
- Parameters
events (List[Spike]) – A list of events that will be streamed to the device
dt (float) – Length of each time step for rasterization
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 (torch.Tensor) – A 4 dimensional tensor of spike events with the dimensions [Time, Channel, Height, Width]
- get_config_builder() sinabs.backend.dynapcnn.config_builder.ConfigBuilder [source]#
- raster_to_events(raster: torch.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 (List[Spike]) – A list of events that will be streamed to the device
- 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'>}#
- xytp_to_events(xytp: numpy.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, timestamp, 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 (List[Spike]) – A list of events that will be streamed to the device