Class Layer
Defined in File Layer.h
Inheritance Relationships
Derived Type
public EvSpikeSim::FCLayer(Class FCLayer)
Class Documentation
-
class Layer
Base class for layers.
Subclassed by EvSpikeSim::FCLayer
Public Functions
-
Layer(const std::initializer_list<unsigned int> &weights_dims, unsigned int n_inputs, unsigned int n_neurons, float tau_s, float threshold, Initializer &initializer, unsigned int buffer_size, get_traces_tau_fct traces_tau_fct = get_traces_tau, infer_kernel_fct kernel_fct = infer_kernel)
Constructs the base layer.
- Parameters
weights_dims – The dimension of weights.
n_inputs – The number of input neurons.
n_neurons – The number of neurons in the layer.
tau_s – The synaptic time constant.
threshold – The threshold.
initializer – The initializer to use to initialize weights.
buffer_size – The size (per neuron) of the post-synaptic spike times buffer used during inference.
traces_tau_fct – The function returning the time constants of synaptic and neuron eligibility traces.
kernel_fct – The inference kernel function.
-
const SpikeArray &infer(const SpikeArray &pre_spikes)
Infer the layer using the given pre-synaptic spike array.
- Parameters
pre_spikes – Pre-synaptic spikes.
- Returns
Constant reference on the post-synaptic spike array.
-
inline unsigned int get_n_inputs() const
Gets the number of input neurons.
- Returns
The number of input neurons.
-
inline unsigned int get_n_neurons() const
Gets the number of neurons in the layer.
- Returns
The number of neurons in the layer.
-
inline float get_tau_s() const
Gets the synaptic time constant.
- Returns
The synaptic time constant.
-
inline float get_tau() const
Gets the membrane time constant.
- Returns
The membrane time constant (2 * tau_s).
-
inline float get_threshold() const
Gets the threshold.
- Returns
The threshold.
-
inline NDArray<float> &get_weights()
Gets the weights of the layer
- Returns
A reference on the NDArray storing the weights of the layer.
-
inline const SpikeArray &get_post_spikes() const
Gets the post-synaptic spikes (updated after calling infer).
- Returns
A const reference on the post-synaptic spike array
-
inline const EvSpikeSim::vector<unsigned int> &get_n_spikes() const
Gets the number of post-synaptic spikes fired by each neuron.
- Returns
A array of spike counts.
-
inline unsigned int get_n_synaptic_traces() const
Gets the number of eligibility traces per synapse.
- Returns
The number of eligibility traces per synapse.
-
inline unsigned int get_n_neuron_traces() const
Gets the number of traces per neuron (to not be confused with synaptic traces).
- Returns
The number of traces per neuron.
-
Layer(const std::initializer_list<unsigned int> &weights_dims, unsigned int n_inputs, unsigned int n_neurons, float tau_s, float threshold, Initializer &initializer, unsigned int buffer_size, get_traces_tau_fct traces_tau_fct = get_traces_tau, infer_kernel_fct kernel_fct = infer_kernel)