Heaviside

Heaviside#

:class:~sinabs.activation.Heaviside surrogate gradient.

import matplotlib.pyplot as plt
import torch

import sinabs.activation as sina

x = torch.linspace(-2, 4, 500)
plt.plot(x, sina.Heaviside(window=0.5)(v_mem=x, spike_threshold=1.0), label="Heaviside")
plt.xlabel("Neuron membrane potential")
plt.ylabel("Derivative")
plt.legend()
<matplotlib.legend.Legend at 0x7f29007afed0>
../../_images/647c28bfdadead10f32c850b83a188a015c97d71371dace3524da66d4f34da44.png