braincore.surrogate.multi_gaussian_grad#
- braincore.surrogate.multi_gaussian_grad(x, h=0.15, s=6.0, sigma=0.5, scale=0.5)[source]#
Spike function with the multi-Gaussian gradient function [1].
The forward function:
\[\begin{split}g(x) = \begin{cases} 1, & x \geq 0 \\ 0, & x < 0 \\ \end{cases}\end{split}\]Backward function:
\[\begin{array}{l} g'(x)=(1+h){{{\mathcal{N}}}}(x, 0, {\sigma }^{2}) -h{{{\mathcal{N}}}}(x, \sigma,{(s\sigma )}^{2})- h{{{\mathcal{N}}}}(x, -\sigma ,{(s\sigma )}^{2}) \end{array}\]>>> import braincore as bc >>> import matplotlib.pyplot as plt >>> xs = jax.numpy.linspace(-3, 3, 1000) >>> grads = bc.vector_grad(bc.surrogate.multi_gaussian_grad)(xs) >>> plt.plot(xs, grads) >>> plt.show()
- Parameters:
- Returns:
out – The spiking state.
- Return type:
jax.Array
References