hxtorch.spiking.functional.SuperSpike

class hxtorch.spiking.functional.SuperSpike(*args, **kwargs)

Bases: torch.autograd.function.Function

Define Surrogate Gradient ‘SuperSpike’ (negative side of Fast Sigmoid) See: https://arxiv.org/abs/1705.11146

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

backward(ctx, grad_output)

Implements surrogate gradient ‘SuperSpike’ for backward.

forward(ctx, input, alpha)

Forward function, generating spikes at positions > 0.

Attributes

static backward(ctx, grad_output: torch.Tensor)Tuple[Optional[torch.Tensor], ]

Implements surrogate gradient ‘SuperSpike’ for backward.

Parameters

grad_output – Back-propagated gradient.

Returns

SuperSpike gradient multiplied to back-propagated gradient.

static forward(ctx, input: torch.Tensor, alpha: float)torch.Tensor

Forward function, generating spikes at positions > 0.

Parameters
  • input – Tensor holding v_mem - v_th, of > 0 a spike at the corresponding entry is generated. Saved for backward.

  • alpha – Parameter controlling the slope of the surrogate derivative. Saved for backward.

Returns

A boolean tensor holding True at the entries for neurons emitting a spike.