hxtorch.spiking.functional.surrogates

Modules

hxtorch.spiking.functional.surrogates.saturate

A collection of surrogate functions for the torch.clamp() function.

hxtorch.spiking.functional.surrogates.spike

A collection of surrogate functions providing functionality for making spiking outputs differentiable.

Functions

hxtorch.spiking.functional.surrogates.clamp(input: torch.Tensor, lower: torch.Tensor, upper: torch.Tensor)torch.Tensor

Wrapper for Clamp.apply()

hxtorch.spiking.functional.surrogates.exponential_rolloff(input: torch.Tensor, lower: torch.Tensor, upper: torch.Tensor, rolloff_margin: float = 0.03, rolloff_margin_abs: float = 0.05)torch.Tensor

Wrapper for ExponentialRolloff.apply()

hxtorch.spiking.functional.surrogates.exponential_rolloff_func(input: torch.Tensor, lower: torch.Tensor, upper: torch.Tensor, rolloff_margin: float = 0.03, rolloff_margin_abs: float = 0.05)torch.Tensor

Linear function capped at lower- and upper bounds with a roll off between the linear and the constant sections. :param input: Tensor, to which the function is applied to. :param lower: Lower threshold. If infinite, the roll off on the lower end

is not applied at all.

Parameters
  • upper – Upper threshold.

  • rolloff_margin – Size of the margin from the bounds inwards, in which the roll off is active. Value relative to the distance between the bounds.

  • rolloff_margin_abs – Absolute size of the margin from the bounds inwards, in which the roll off is active. This value is needed as a fallback, in case one of the thresholds is infinite.

hxtorch.spiking.functional.surrogates.superspike(input: torch.Tensor, alpha: float)torch.Tensor