hxtorch.spiking.InputNeuron

class hxtorch.spiking.InputNeuron(size: int, experiment: Experiment, execution_instance: Optional[ExecutionInstance] = None)

Bases: hxtorch.spiking.modules.types.Population

Spike source generating spikes at the times [ms] given in the spike_times array.

__init__(size: int, experiment: Experiment, execution_instance: Optional[ExecutionInstance] = None)None

Instantiate a InputNeuron. This module serves as an External Population for input injection and is created within experiment if not present in the considered model. This module performs an identity mapping when forward is called.

Parameters
  • size – Number of input neurons.

  • experiment – Experiment to which this module is assigned.

  • execution_instance – Execution instance to place to.

Methods

__init__(size, experiment[, execution_instance])

Instantiate a InputNeuron.

add_to_input_generator(input, builder)

Add the neurons events represented by this instance to grenades input generator.

add_to_network_graph(builder)

Adds instance to grenade’s network builder.

post_process(hw_data, runtime)

This methods needs to be overridden for every derived module that demands hardware observables and is intended to translated hardware- affine datatypes returned by grenade into PyTorch tensors.

register_hw_entity()

Register instance in member experiment.

Attributes

add_to_input_generator(input: hxtorch.spiking.handle.NeuronHandle, builder: _pygrenade_vx_network.InputGenerator)None

Add the neurons events represented by this instance to grenades input generator.

Parameters
  • input – Dense spike tensor. These spikes are implicitly converted to spike times. TODO: Allow sparse tensors.

  • builder – Grenade’s input generator to append the events to.

add_to_network_graph(builder: _pygrenade_vx_network.NetworkBuilder)_pygrenade_vx_network.PopulationOnNetwork

Adds instance to grenade’s network builder.

Parameters

builder – Grenade network builder to add external population to.

Returns

External population descriptor.

output_type

alias of hxtorch.spiking.handle.NeuronHandle

post_process(hw_data: HardwareObservables, runtime: float)Tuple[Optional[torch.Tensor], ]

This methods needs to be overridden for every derived module that demands hardware observables and is intended to translated hardware- affine datatypes returned by grenade into PyTorch tensors.

Parameters
  • hw_data – A HardwareObservables instance holding the hardware data assigned to this module.

  • runtime – The requested runtime of the experiment on hardware in s.

  • dt – The expected temporal resolution in hxtorch.

Returns

Hardware data represented as torch.Tensors. Note that torch.Tensors are required here to enable gradient flow.

register_hw_entity()None

Register instance in member experiment.