evspikesim.SpikingNetwork
- class evspikesim.SpikingNetwork
Spiking Neural Network (SNN) composed of layers of spiking neurons.
- __init__(self: evspikesim.SpikingNetwork, compile_path: str = '/tmp/evspikesim') None
Constructs an empty SNN.
- Parameters
compile_path (str) – Compilation path for custom kernel callback sources.
Methods
add_fc_layer(self, n_inputs, n_neurons, ...)Adds a fully-connected (FC) layer with the given arguments to the network.
add_fc_layer_from_source(self, n_inputs, ...)Adds a layer of type LayerType with a custom kernel callbacks source.
infer(*args, **kwargs)Overloaded function.
Attributes
The output layer (i.e.
- __getitem__(self: evspikesim.SpikingNetwork, index: int) EvSpikeSim::Layer
Gets the layer at the specified index.
- Parameters
index (int) – The index of the layer.
- Returns
The requested layer.
- Return type
- __iter__(self: evspikesim.SpikingNetwork) Iterator
Gets an iterator on the first layer.
- Returns
An iterator on the first layer.
- Return type
Iterator
- add_fc_layer(self: evspikesim.SpikingNetwork, n_inputs: int, n_neurons: int, tau_s: float, threshold: float, initializer: EvSpikeSim::Initializer, buffer_size: int = 64) EvSpikeSim::FCLayer
Adds a fully-connected (FC) layer with the given arguments to the network. The added layer uses the default kernel during inference.
- Parameters
n_inputs (int) – The number of input neurons.
n_neurons (int) – The number of neurons in the layer.
tau_s (float) – The synaptic time constant of the neurons. The membrane time constant will be defined as twice tau_s.
threshold (float) – The threshold of the neurons.
initializer (Initializer.) – The initializer to use to initialize the weights of the layer.
buffer_size – The size (per neuron) of the post-synaptic spike times buffer used during inference.
- Returns
The newly created FCLayer object.
- Return type
- add_fc_layer_from_source(self: evspikesim.SpikingNetwork, n_inputs: str, src_path: int, n_neurons: int, tau_s: float, threshold: float, initializer: EvSpikeSim::Initializer, buffer_size: int = 64) EvSpikeSim::FCLayer
Adds a layer of type LayerType with a custom kernel callbacks source. If not already used, the given source file is compiled and loaded by the JITCompiler.
- Parameters
src_path (str) – Path to the kernel callbacks source file.
n_inputs (int) – The number of input neurons.
n_neurons (int) – The number of neurons in the layer.
tau_s (float) – The synaptic time constant of the neurons. The membrane time constant will be defined as twice tau_s.
threshold (float) – The threshold of the neurons.
initializer (Initializer.) – The initializer to use to initialize the weights of the layer.
buffer_size – The size (per neuron) of the post-synaptic spike times buffer used during inference.
- Returns
The newly created FCLayer object.
- Return type
- infer(*args, **kwargs)
Overloaded function.
infer(self: evspikesim.SpikingNetwork, inputs: evspikesim.SpikeArray) -> evspikesim.SpikeArray
Infer the entire SNN using the given input spike array.
- Parameters
inputs (SpikeArray.) – Sorted input spikes.
- Returns
The output spike array.
- Return type
infer(self: evspikesim.SpikingNetwork, indices: List[int], times: List[float]) -> evspikesim.SpikeArray
Infer the entire SNN using the given input spike indices and times.
- Parameters
indices (List[int]) – Input spike indices.
times (List[float]) – Input spike times.
- Returns
The output spike array.
- Return type
- property output_layer
The output layer (i.e. the last layer of the network).