lava.lib.dnf.inputs.rate_code_spike_gen
lava.lib.dnf.inputs.rate_code_spike_gen.models

- class lava.lib.dnf.inputs.rate_code_spike_gen.models.RateCodeSpikeGenProcessModel(proc_params)
Bases:
PyLoihiProcessModel
PyLoihiProcessModel for SpikeGeneratorProcess.
Implements the behavior of a rate-coded spike input generator.
- a_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'float'>, precision=None)
- first_spike_times: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'int'>, precision=None)
- implements_process
alias of
RateCodeSpikeGen
- implements_protocol
alias of
LoihiProtocol
- inter_spike_distances: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'int'>, precision=None)
- last_spiked: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
- min_spike_rate: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
- required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]
- run_spk()
Function that runs in Spiking Phase
- Return type
None
- s_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'bool'>, precision=None)
- seed: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'int'>, precision=None)
- spikes: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'bool'>, precision=None)
lava.lib.dnf.inputs.rate_code_spike_gen.process

- class lava.lib.dnf.inputs.rate_code_spike_gen.process.RateCodeSpikeGen(**kwargs)
Bases:
AbstractProcess
Spike generator Process for rate-coded input.
This process generates spike trains based on patterns it receives through its InPort a_in. It interprets these patterns as spiking rates (rate coding).
Receives a new pattern through a_in only once and while and trigger state update upon receipt of new pattern. In other time steps, receives null patterns (array full of numpy.nan). Sends spike values through its OutPort s_out every time step.
Parameters:
- shape: tuple(int)
number of neurons per dimension, e.g. shape=(30, 40)
- min_spike_rate: float
minimum spike rate (neurons with rates below this value will never spike)
- seed: int
seed used for computing first spike times everytime pattern changes