Piecewise Linear#

class src.model.SurrogateGradient.PiecewiseLinear(*args, **kwargs)#

Bases: Function

Class that implements the piecewise linear function (Esser et al.) as the surrogate gradient for the backward pass.

static backward(ctx, grad_output: Tensor) Tensor#

Backward pass using surrogate gradient function: piecewise linear function (Esser et al.)

static forward(ctx, input_: Tensor) Tensor#

Forward pass using 'Heaviside step function'

spiking_mode: str = 'binary'#
surrogate_scale: float = 1.0#