hxtorch.spiking.utils.to_nir.SNN

class hxtorch.spiking.utils.to_nir.SNN(dt: float = 1e-06, mock: bool = True, device: torch.device = device(type='cpu'))

Bases: torch.nn.modules.module.Module

Base SNN class for to-NIR conversion. It is necessary to define the forward pass.

__init__(dt: float = 1e-06, mock: bool = True, device: torch.device = device(type='cpu'))None

Initialize the SNN.

Parameters
  • dt – Time-binning width.

  • mock – Indicating whether to train in software (True) or on hardware (False).

Methods

__init__([dt, mock, device])

Initialize the SNN.

forward(spikes)

Perform a forward pass.

Attributes

forward(spikes: torch.Tensor)torch.Tensor

Perform a forward pass. To use the SNN class for to-NIR conversion, it is necessary to define the forward pass.

Parameters

spikes – torch.Tensor holding spikes as input.

Returns

Returns the output of the network, i.e. membrane traces of the readout neurons.