
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/surrogate_grad_fns/plot_periodicexponential.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_surrogate_grad_fns_plot_periodicexponential.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_surrogate_grad_fns_plot_periodicexponential.py:


===================
PeriodicExponential
===================
:class:`~sinabs.activation.PeriodicExponential` surrogate gradient.

.. GENERATED FROM PYTHON SOURCE LINES 7-22



.. image-sg:: /auto_examples/surrogate_grad_fns/images/sphx_glr_plot_periodicexponential_001.png
   :alt: plot periodicexponential
   :srcset: /auto_examples/surrogate_grad_fns/images/sphx_glr_plot_periodicexponential_001.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


    <matplotlib.legend.Legend object at 0x7fd7c9ca8910>





|

.. code-block:: default


    import matplotlib.pyplot as plt
    import torch

    import sinabs.activation as sina

    x = torch.linspace(-2, 4, 500)
    plt.plot(
        x,
        sina.PeriodicExponential()(v_mem=x, spike_threshold=1.0),
        label="PeriodicExponential",
    )
    plt.xlabel("Neuron membrane potential")
    plt.ylabel("Derivative")
    plt.legend()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.128 seconds)


.. _sphx_glr_download_auto_examples_surrogate_grad_fns_plot_periodicexponential.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example


    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_periodicexponential.py <plot_periodicexponential.py>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_periodicexponential.ipynb <plot_periodicexponential.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
