samna.dynapcnnB.configuration#
Submodules#
Module content#
- class samna.dynapcnnB.configuration.CnnLayerConfig#
Bases:
pybind11_object
Configuration options for CNN layers.
- property biases#
Contains bias values for features in a layer.
Formatted as [feature].
- Type:
tensor array
- property destinations#
List of 2
CnnLayerDestination
which describe target destination layers for events produced in this layer.- Type:
Array of 2 fixed length
- property dimensions#
Specifies padding, stride, kernel size and I/O shape of the layer.
- Type:
Instance of
CnnLayerDimensions
- from_json(self: samna.dynapcnnB.configuration.CnnLayerConfig, arg0: str) None #
- property input_congestion_balancer_enable#
Enable input congestion balancer.
- Type:
bool
- property leak_enable#
Enable leak/bias processing for this layer. A slow clk must be provided to SLOW_CLK pin.
CAUTION: May impact performance significantly.
- Type:
bool
- property leak_internal_slow_clk_enable#
forward internally generated slow clock to convolutional layers’ leak generator to replace the need of external slow clk. The
leakEnable
must be set to True first- Type:
bool
- property monitor_enable#
Enable monitoring of this layer. When True all events produced by this layer will also be output on the monitoring bus. When False, events will only go to layers selected in the
destinations
list.Monitoring should only be enabled on development kits that support fast readout of events.
- Type:
bool
- property neurons_initial_value#
Contains initial neuron membrane potential values for neurons in a layer.
Formatted as [feature][x][y].
- Type:
tensor array
- property output_decimator_enable#
Enable output decimator.
- Type:
bool
- property output_decimator_interval#
Output decimator block interval.
- Type:
int
- property return_to_zero#
If True neurons in this layer will return to 0 when firing. Otherwise their threshold will be subtracted from the value their membrane potential reached before firing.
- Type:
bool
- property threshold_high#
Set the high threshold. When the neuron membrane potential becomes equal to or great than this value the neuron will fire.
- Type:
int
- property threshold_low#
The minimum value of the neuron membrane potential which cannot be surpassed by leak.
- Type:
int
- to_json(self: samna.dynapcnnB.configuration.CnnLayerConfig) str #
- property weights#
4 dimensional list of lists representing kernel parameters.
Formatted as [feature][channel][x][y].
- Type:
tensor array
- class samna.dynapcnnB.configuration.CnnLayerDestination#
Bases:
pybind11_object
Configuration options for CNN layer destinations.
- property enable#
Enable this destination. If False no events will be forwarded, if True all events will be forwarded to this destination.
- Type:
bool
- property feature_shift#
Shift feature IDs. The feature ID observed in the target layer will be the ID in this layer + feature_shift.
- Type:
int
- from_json(self: samna.dynapcnnB.configuration.CnnLayerDestination, arg0: str) None #
- property layer#
Target layer ID. Allowed values [0, 4] and 6, where [0,4] is the CNN layers and layer 6 is the readout layer. If you want to send Spike events to the readout block from outside, you need to set the target layer of the Spike event to 5.
- Type:
int
- property pooling#
{1, 2, 4, 8}
- Type:
int
- Type:
Pooling will be applied to events before reaching the selected destination layer. Allowed values
- to_json(self: samna.dynapcnnB.configuration.CnnLayerDestination) str #
- class samna.dynapcnnB.configuration.CnnLayerDimensions#
Bases:
pybind11_object
Describes the dimensions of a Cnn layer as the configurable parameters.
- from_json(self: samna.dynapcnnB.configuration.CnnLayerDimensions, arg0: str) None #
- get_biases_array_dimensions(self: samna.dynapcnnB.configuration.CnnLayerDimensions) List[int[1]] #
Function to get the dimension of the bias array.
- Returns:
A list of the dimension in the format of [feature].
- get_neuron_states_array_dimensions(self: samna.dynapcnnB.configuration.CnnLayerDimensions) List[int[3]] #
Function to get the dimension of the neuron states array.
- Returns:
A list of the dimension in the format of [feature, x, y].
- get_weights_array_dimensions(self: samna.dynapcnnB.configuration.CnnLayerDimensions) List[int[4]] #
Function to get the dimension of the weights array.
- Returns:
A list of the dimension in the format of [feature, channel, x, y].
- property kernel_size#
Kernel size for all features in this layer. All kernels are square. Allowable values [1, 16]
- Type:
int
- property padding#
Padding of all features in this layer. Allowable values [0, 7].
- Type:
Instance of
Vec2
- property stride#
Stride for all features in this layer. Allowable values {1, 2, 4, 8}.
- Type:
Instance of
Vec2
- to_json(self: samna.dynapcnnB.configuration.CnnLayerDimensions) str #
- class samna.dynapcnnB.configuration.DvsFilterConfig#
Bases:
pybind11_object
The DVS Filter Block is included in the DVS pre-processing layer of Speck 2e in order to filter events depending on neighboring pixel activity. In general, an event at position (x,y) is forwarded by the filter when at least one pixel in the vicinity of (x,y) has spiked in a defined time window before the (x,y) event.
- property enable#
Enable the filter. A slow clk must be provided to SLOW_CLK pin.
- Type:
bool
- property filter_size#
Filter window size in the X/Y dimension.
- Type:
Instance of
Vec2
- from_json(self: samna.dynapcnnB.configuration.DvsFilterConfig, arg0: str) None #
- property hot_pixel_filter_enable#
Enable hot pixel filtering, default is enabled. The
enable
has to be set True first.- Type:
bool
- property internal_slow_clk#
Forward internally generated slow clock to DVS filter to replace the need of external slow clk. The
enable
must be set to True first.- Type:
bool
- property threashold#
Defines the threshold of the filter. This value is used to compare the current counter value with the value of the pixels neighboring the current spiking pixel. If any of the neighboring pixels has a value difference withing the delta value, the filter emits the current spike. Otherwise, the current spike is blocked.
- Type:
int
- to_json(self: samna.dynapcnnB.configuration.DvsFilterConfig) str #
- class samna.dynapcnnB.configuration.DvsLayerConfig#
Bases:
pybind11_object
Configuration options for event pre-process layer. The event pre-processing layer receives as input the events coming from the internal DVS, or from an external source through the Input Serial Interface
- property cut#
Select the cut range, the roi cut happens concurrently, the range needs to be defined from the sensors (original) origin).
Actually it cuts an area using the given size based on (0, 0), then adjust this area according to origin.
- Type:
Instance of
Vec2
- property destinations#
Destinations
- Type:
list of 2
DvsLayerDestination
- from_json(self: samna.dynapcnnB.configuration.DvsLayerConfig, arg0: str) None #
- property merge#
Whether merge the two polarity from dvs (On/Off).
If True, Merge all events marking them with Polarity = ‘1’. If False, Pass all events and maintain the polarity information.
- Type:
bool
- property mirror#
Enable mirroring (1) or not (0) of the X or Y dimension. mirroring is reversing image on X or Y dimension.
- Type:
object(x bool, y bool)
- property mirror_diagonal#
Enables mirroring of the input events along the diagonal. when set to ‘1’, it swaps X with Y.
- Type:
bool
- property monitor_enable#
Enables the DVS Pre-Processing Layer Monitor Bus. When enabled, output messages of the dvs pre-processing block are forwarded on the monitor bus to the output serial interface.
- Type:
bool
- property off_channel#
Whether pass events with OFF polarity, only make sense when merge equal to True.
If True, pass events with OFF polarity. If False, block events with OFF polarity
- Type:
bool
- property on_channel#
Whether pass events with ON polarity, only make sense when merge equal to True.
If True, pass events with ON polarity. If False, block events with ON polarity
- Type:
bool
- property origin#
Select the origin offset the roi cut happens concurrently, the offset needs to be defined from the sensors (original) origin).
Actually this origin will redefined the area after cut.
- Type:
Instance of
Vec2
- property pooling#
Pooling is restricting dvs events in an area, available values are {1, 2, 4}, you can set pooling value on X/Y dimension seperately.
For example, if you set config.dvs_layer.pooling.x = 2 and config.dvs_layer.pooling.y = 2, you will see a 1/4 area on top left of visualizer which show pixels and other areas will be blank
- Type:
Instance of
Vec2
- to_json(self: samna.dynapcnnB.configuration.DvsLayerConfig) str #
- class samna.dynapcnnB.configuration.DvsLayerDestination#
Bases:
pybind11_object
Configuration options for dvs layer destination. It can have 2 destinations.
- property enable#
if this destination is enabled.
- Type:
bool
- from_json(self: samna.dynapcnnB.configuration.DvsLayerDestination, arg0: str) None #
- property layer#
destination layer that is going to receive output data.
- Type:
int
- to_json(self: samna.dynapcnnB.configuration.DvsLayerDestination) str #
- class samna.dynapcnnB.configuration.DynapcnnConfiguration#
Bases:
pybind11_object
Contains configuration options and network parameters for a DynapCNN-B device. Applied to a device via apply_configuration() on the device model.
The configuration is divided into settings for the 9 CNN layers, the DVS event pre-processing layer and the readout layer. The factory configuration and debug configuration sub structs are pre-populated with default values and are only used for debug scenarios.
- property cnn_layers#
List of 5
CnnLayerConfig
.
- property debug_config#
Instace of
DebugConfig
- property dvs_filter#
Instance of
DvsFilterConfig
- property dvs_layer#
Instance of
DvsLayerConfig
- property factory_config#
Instance of
FactoryConfig
.
- from_json(self: samna.dynapcnnB.configuration.DynapcnnConfiguration, arg0: str) None #
- property readout#
Instance of
ReadoutConfig
.
- to_json(self: samna.dynapcnnB.configuration.DynapcnnConfiguration) str #
- class samna.dynapcnnB.configuration.IOShape#
Bases:
pybind11_object
Describes the input or output shape of a CNN layer.
- property feature_count#
Number of features in the input or output”
- Type:
int
- from_json(self: samna.dynapcnnB.configuration.IOShape, arg0: str) None #
- property size#
Size of each feature.
- Type:
Instance of
Vec2
- to_json(self: samna.dynapcnnB.configuration.IOShape) str #
- class samna.dynapcnnB.configuration.ReadoutConfig#
Bases:
pybind11_object
The main use of the post-processing block is to calculate the moving average over a time window for a maximum of 15 neurons, provide the maximum average of the 15 neurons and compare the value of the calculated moving averages against a specified threshold.
- property enable#
enable the readout block, a slow clk (frequency depends on the algorithm model) must be provided to SLOW_CLK pin.
- Type:
bool
- from_json(self: samna.dynapcnnB.configuration.ReadoutConfig, arg0: str) None #
- property internal_slow_clk#
forward internally generated slow clk to the readout block to replace the need of external slow clk. The
enable
must be set to True first.- Type:
bool
- property low_pass_filter32_not16#
Selects readout moving average length (16 or 32 clock periods).
Value
Configuration
False
time window = 16* MOVING_AVERAGE_CLK period
True
time window = 32* MOVING_AVERAGE_CLK period
- Type:
bool
- property low_pass_filter_disable#
Disables readout low pass filtering.
Value
Configuration
False
time window = selected by
low_pass_filter32_not16
True
time window = 1 MOVING_AVERAGE_CLK period
This overrides
low_pass_filter32_not16
when set to True.- Type:
bool
- property monitor_enable#
Allow monitoring of readout events, you will receive
ReadoutValue
from the model.Please note that if you turn this on, you can’t get any events from CNN layers or the DVS sensor anymore.
- Type:
bool
- property output_mod_sel#
There are 4 different modes where the output data are multiplexed. In the following table the different data output modes are described:
output_mode_sel
data_out[20]
data_out[19:16]
data_out[15:0]
0b00
data valid
neuron index of max average
power down (clock gating)
0b01
data valid
neuron index of max average
threshold compare output
0b10
data valid
neuron index of max average
average output of the selected neuron
0b11
max spiking neuron above threshold
neuron index of max average
average output of max spiking neuron
If output_mode_sel equals to ‘0b00’ then the clk_gated signal and the
data_out[15:0]
are equal to 0.If output_mode_sel equals to ‘0b01’ then the
data_out[15:0]
consists of the data of the threshold comparison, the index of the maximum moving average neuron and the data valid signal. The threshold comparison data is the 16 bit value of the comparison of each neurons’ moving average with the threshold.If output_mode_sel equals to ‘0b10’ then the
data_out[15:0]
consists of the moving average of the selected neuron, the index of the maximum moving average neuron and the data valid signal. The data valid signal is asserted after all the computations have finished in order to ensure correct sampling of the data.If output_mode_sel equals to ‘0b11’ then the
data_out[15:0]
consists of the maximum average of the 15 neurons, the index of the maximum moving average neuron and the comparison output between the maximum moving average and the threshold.- Type:
int
- property output_neuron_num#
The internal signal output_mode_sel enable the selection of one of the 15 output neurons. The neuron selection is used when signals output_mode_sel == ‘0b10’.
Selected neuron number = average_sel.
- Type:
int
- property override_threshold_max#
Override Output Layer Threshold compare. Sends interrupt at each slow clock cycle.
- Type:
bool
- property readout_configuration_sel#
Addressing modes of the incoming spikes.
There are 4 different addressing modes that could be selected. The valid configurations are the following:
Value
Configuration
0b00
2x*2y*4f
0b10
4x*4y*1f
0b01
2x*4y*2f
0b11
1x*1y*16f
Where x, y and f represent, respectively, the X, Y and Feature dimensions of the events arriving at the Readout Layer.
- Type:
int
- property readout_pin_monitor_enable#
enable/disable the monitor of the readout pins. If enabled, the
ReadoutPinValue
will be outputted. Default isFalse
.- Type:
bool
- property threshold#
Readout neurons threshold value.
The moving average of the output neurons is compared to the threshold value to produce an output if the received number of spikes is greater than the threshold.
- Type:
int
- to_json(self: samna.dynapcnnB.configuration.ReadoutConfig) str #