SpikeTimeHalfKernel

class SpikeTimeHalfKernel(*args, **kwargs)[source]

Bases: Protocol

Callable used for computing the presynaptic or postsynaptic update of pre-post training methods with spike time difference.

The function here should represent the result of \(K(t_\Delta(t))\).

Without delay adjustment:

\[t_\Delta(t) = t_\text{post} - t_\text{pre}\]

With delay adjustment:

\[t_\Delta(t) = t_\text{post} - t_\text{pre} - d(t)\]

Where \(t_\text{post}\) is the time of the last postsynaptic spike, \(t_\text{pre}\) is the time of the last presynaptic spike, and \(d(t)\) are the learned delays.

Parameters:

diff (torch.Tensor) – duration of time, possibly adjusted, between presynaptic and postsynaptic spikes, \(t_\Delta(t)\), in \(\text{ms}\).

Returns:

update component.

Return type:

torch.Tensor

Shape

diff, return:

\(B \times N_0 \times \cdots \times M_0 \times \cdots times L\)

Where:
  • \(B\) is the batch size.

  • \(N_0, \ldots\) are the unbatched output parameter dimensions (e.g. the number of filters in a convolutional connection).

  • \(M_0, \ldots\) are the unbatched input parameter dimensions (e.g. the number of channels and kernel dimensions in a convolutional connection).

  • \(L\) is a connection-specific dimension corresponding to the number of outputs affected by each parameter (e.g. the length of an im2col column in convolutional connections).

Note

Spike times are generally internally recorded as the time since the last spike, with an initial value of \(\infty\). Inputs under normal conditions may therefore include inf, -inf, and nan. Outputs shoud generally avoid inf, -inf, and nan.