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

.. only:: html

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

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

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

.. _sphx_glr_auto_examples_layers_plot_alif.py:


========================================
Adaptive Leaky Integrate and Fire (ALIF)
========================================
:class:`~sinabs.layers.ALIF` layer with an adaptive threshold based on the output spikes. 

.. GENERATED FROM PYTHON SOURCE LINES 7-19



.. image-sg:: /auto_examples/layers/images/sphx_glr_plot_alif_001.png
   :alt: ALIF neuron dynamics
   :srcset: /auto_examples/layers/images/sphx_glr_plot_alif_001.png
   :class: sphx-glr-single-img





.. code-block:: default


    import torch
    from utils import plot_evolution

    import sinabs.layers as sl

    const_current = torch.ones((1, 100, 1)) * 0.12

    alif_neuron = sl.ALIF(
        tau_mem=40.0, tau_adapt=40.0, adapt_scale=20, norm_input=False, record_states=True
    )
    plot_evolution(alif_neuron, const_current)


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

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


.. _sphx_glr_download_auto_examples_layers_plot_alif.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_alif.py <plot_alif.py>`

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

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


.. only:: html

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

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