spark.nn.interfaces#
Submodules#
Classes#
Abstract Interface model. |
|
Abstract Interface model configuration class. |
|
Abstract ControlInterface model. |
|
Abstract ControlInterface model configuration class. |
|
ControlInterface model output spec. |
|
Combines several streams of inputs of the same type into a single stream. |
|
Concat configuration class. |
|
Combines several streams of inputs of the same type into a single stream. |
|
ConcatReshape configuration class. |
|
Sample a single input streams of inputs of the same type into a single stream. |
|
Sampler configuration class. |
|
Abstract input interface model. |
|
Abstract InputInterface model configuration class. |
|
InputInterface model output spec. |
|
Transforms a continuous signal to a spiking signal. |
|
PoissonSpiker model configuration class. |
|
Transforms a continuous signal to a spiking signal. |
|
LinearSpiker model configuration class. |
|
Transforms a continuous signal to a spiking signal. |
|
TopologicalPoissonSpiker configuration class. |
|
Transforms a continuous signal to a spiking signal. |
|
TopologicalLinearSpiker configuration class. |
|
Abstract OutputInterface model. |
|
Abstract OutputInterface model configuration class. |
|
OutputInterface model output spec. |
|
Transforms a discrete spike signal to a continuous signal. |
|
ExponentialIntegrator configuration class. |
Package Contents#
- class spark.nn.interfaces.Interface(config=None, **kwargs)[source]#
Bases:
spark.core.module.SparkModule,abc.ABC,Generic[ConfigT]Abstract Interface model.
- Parameters:
config (ConfigT | None)
- class spark.nn.interfaces.InterfaceConfig(**kwargs)[source]#
Bases:
spark.core.config.SparkConfigAbstract Interface model configuration class.
- class spark.nn.interfaces.ControlInterface(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.base.Interface,abc.ABC,Generic[ConfigT]Abstract ControlInterface model.
- Parameters:
config (ConfigT | None)
- class spark.nn.interfaces.ControlInterfaceConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.base.InterfaceConfigAbstract ControlInterface model configuration class.
- class spark.nn.interfaces.ControlInterfaceOutput[source]#
Bases:
TypedDictControlInterface model output spec.
Initialize self. See help(type(self)) for accurate signature.
- class spark.nn.interfaces.Concat(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.control.base.ControlInterfaceCombines several streams of inputs of the same type into a single stream.
- Init:
num_inputs: int payload_type: type[SparkPayload]
- Input:
input: type[SparkPayload]
- Output:
output: type[SparkPayload]
- Parameters:
config (ConcatConfig | None)
- config: ConcatConfig[source]#
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(inputs)[source]#
Merge all input streams into a single data output stream.
- Parameters:
inputs (list[spark.core.payloads.SparkPayload])
- Return type:
- class spark.nn.interfaces.ConcatConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.control.base.ControlInterfaceConfigConcat configuration class.
- class spark.nn.interfaces.ConcatReshape(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.control.base.ControlInterfaceCombines several streams of inputs of the same type into a single stream.
- Init:
num_inputs: int reshape: tuple[int, …] payload_type: type[SparkPayload]
- Input:
input: type[SparkPayload]
- Output:
output: type[SparkPayload]
- Parameters:
config (ConcatReshapeConfig | None)
- config: ConcatReshapeConfig[source]#
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(inputs)[source]#
Merge all input streams into a single data output stream. Output stream is reshape to match the pre-specified shape.
- Parameters:
inputs (list[spark.core.payloads.SparkPayload])
- Return type:
- class spark.nn.interfaces.ConcatReshapeConfig(**kwargs)[source]#
Bases:
ConcatConfigConcatReshape configuration class.
- class spark.nn.interfaces.Sampler(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.control.base.ControlInterfaceSample a single input streams of inputs of the same type into a single stream. Indices are selected randomly and remain fixed.
- Init:
sample_size: int
- Input:
input: type[SparkPayload]
- Output:
output: type[SparkPayload]
- Parameters:
config (SamplerConfig | None)
- config: SamplerConfig[source]#
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(inputs)[source]#
Sub/Super-sample the input stream to get the pre-specified number of samples.
- Parameters:
inputs (spark.core.payloads.SparkPayload)
- Return type:
- class spark.nn.interfaces.SamplerConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.control.base.ControlInterfaceConfigSampler configuration class.
- class spark.nn.interfaces.InputInterface(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.base.Interface,abc.ABC,Generic[ConfigT]Abstract input interface model.
- Parameters:
config (ConfigT | None)
- class spark.nn.interfaces.InputInterfaceConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.base.InterfaceConfigAbstract InputInterface model configuration class.
- class spark.nn.interfaces.InputInterfaceOutput[source]#
Bases:
TypedDictInputInterface model output spec.
Initialize self. See help(type(self)) for accurate signature.
- class spark.nn.interfaces.PoissonSpiker(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.input.base.InputInterfaceTransforms a continuous signal to a spiking signal. This transformation assumes a very simple poisson neuron model without any type of adaptation or plasticity.
- Init:
max_freq: float [Hz]
- Input:
signal: FloatArray
- Output:
spikes: SpikeArray
- Parameters:
config (PoissonSpikerConfig | None)
- config: PoissonSpikerConfig[source]#
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(signal)[source]#
Input interface operation.
- Input:
A FloatArray of values in the range [0,1].
- Output:
A SpikeArray of the same shape as the input.
- Parameters:
signal (spark.core.payloads.FloatArray)
- Return type:
- class spark.nn.interfaces.PoissonSpikerConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.input.base.InputInterfaceConfigPoissonSpiker model configuration class.
- class spark.nn.interfaces.LinearSpiker(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.input.base.InputInterfaceTransforms a continuous signal to a spiking signal. This transformation assumes a very simple linear neuron model without any type of adaptation or plasticity. Units have a fixed refractory period and at maximum input signal will fire up to some fixed frequency.
- Init:
tau: float [ms] cd: float [ms] max_freq: float [Hz]
- Input:
signal: FloatArray
- Output:
spikes: SpikeArray
- Parameters:
config (LinearSpikerConfig | None)
- config: LinearSpikerConfig[source]#
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(signal)[source]#
Input interface operation.
- Input:
A FloatArray of values in the range [0,1].
- Output:
A SpikeArray of the same shape as the input.
- Parameters:
signal (spark.core.payloads.FloatArray)
- Return type:
- class spark.nn.interfaces.LinearSpikerConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.input.base.InputInterfaceConfigLinearSpiker model configuration class.
- class spark.nn.interfaces.TopologicalPoissonSpiker(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.input.base.InputInterfaceTransforms a continuous signal to a spiking signal. This transformation maps a vector (a point in a hypercube) into a simple manifold with/without its borders glued. This transformation assumes a very simple poisson neuron model without any type of adaptation or plasticity.
- Init:
glue: jax.Array mins: jax.Array maxs: jax.Array resolution: int max_freq: float [Hz] sigma: float
- Input:
signal: FloatArray
- Output:
spikes: SpikeArray
- Parameters:
config (TopologicalPoissonSpikerConfig | None)
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(signal)[source]#
Input interface operation.
Input: A FloatArray of values in the range [mins, maxs]. Output: A SpikeArray of the same shape as the input.
- Parameters:
signal (spark.core.payloads.FloatArray)
- Return type:
- class spark.nn.interfaces.TopologicalPoissonSpikerConfig(**kwargs)[source]#
Bases:
TopologicalSpikerConfig,spark.nn.interfaces.input.poisson.PoissonSpikerConfigTopologicalPoissonSpiker configuration class.
- class spark.nn.interfaces.TopologicalLinearSpiker(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.input.base.InputInterfaceTransforms a continuous signal to a spiking signal. This transformation maps a vector (a point in a hypercube) into a simple manifold with/without its borders glued. This transformation assumes a very simple linear neuron model without any type of adaptation or plasticity.
- Init:
glue: jax.Array mins: jax.Array maxs: jax.Array resolution: int tau: float [ms] cd: float [ms] max_freq: float [Hz] sigma: float
- Input:
signal: FloatArray
- Output:
spikes: SpikeArray
- Parameters:
config (TopologicalLinearSpikerConfig | None)
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(signal)[source]#
Input interface operation.
Input: A FloatArray of values in the range [mins, maxs]. Output: A SpikeArray of the same shape as the input.
- Parameters:
signal (spark.core.payloads.FloatArray)
- Return type:
- class spark.nn.interfaces.TopologicalLinearSpikerConfig(**kwargs)[source]#
Bases:
TopologicalSpikerConfig,spark.nn.interfaces.input.linear.LinearSpikerConfigTopologicalLinearSpiker configuration class.
- class spark.nn.interfaces.OutputInterface(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.base.Interface,abc.ABC,Generic[ConfigT]Abstract OutputInterface model.
- Parameters:
config (ConfigT | None)
- class spark.nn.interfaces.OutputInterfaceConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.base.InterfaceConfigAbstract OutputInterface model configuration class.
- class spark.nn.interfaces.OutputInterfaceOutput[source]#
Bases:
TypedDictOutputInterface model output spec.
Initialize self. See help(type(self)) for accurate signature.
- class spark.nn.interfaces.ExponentialIntegrator(config=None, **kwargs)[source]#
Bases:
spark.nn.interfaces.output.base.OutputInterfaceTransforms a discrete spike signal to a continuous signal. This transformation assumes a very simple integration model model without any type of adaptation or plasticity. Spikes are grouped into k non-overlaping clusters and every neuron contributes the same amount to the ouput.
- Init:
num_outputs: int saturation_freq: float [Hz] tau: float [ms] shuffle: bool smooth_trace: bool
- Input:
spikes: SpikeArray
- Output:
signal: FloatArray
- Parameters:
config (ExponentialIntegratorConfig)
- build(input_specs)[source]#
Build method.
- Parameters:
input_specs (dict[str, spark.core.specs.InputSpec])
- Return type:
None
- __call__(spikes)[source]#
Transform incomming spikes into a output signal.
- Parameters:
spikes (spark.core.payloads.SpikeArray)
- Return type:
- class spark.nn.interfaces.ExponentialIntegratorConfig(**kwargs)[source]#
Bases:
spark.nn.interfaces.output.base.OutputInterfaceConfigExponentialIntegrator configuration class.