
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/layers/plot_iaf.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_iaf.py>`
        to download the full example code

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

.. _sphx_glr_auto_examples_layers_plot_iaf.py:


========================
Integrate and Fire (IAF)
========================
:class:`~sinabs.layers.IAF` layer.

.. GENERATED FROM PYTHON SOURCE LINES 7-23



.. rst-class:: sphx-glr-horizontal


    *

      .. image-sg:: /auto_examples/layers/images/sphx_glr_plot_iaf_001.png
         :alt: IAF neuron dynamics
         :srcset: /auto_examples/layers/images/sphx_glr_plot_iaf_001.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/layers/images/sphx_glr_plot_iaf_002.png
         :alt: IAF neuron dynamics
         :srcset: /auto_examples/layers/images/sphx_glr_plot_iaf_002.png
         :class: sphx-glr-multi-img





.. code-block:: default


    import torch
    from utils import plot_evolution

    import sinabs.layers as sl

    const_current = torch.ones((1, 100, 1)) * 0.03
    single_current = torch.zeros((1, 100, 1))
    single_current[:, 0] = 0.1

    iaf_neuron = sl.IAF(record_states=True)
    plot_evolution(iaf_neuron, const_current)


    iaf_neuron = sl.IAF(tau_syn=15.0, record_states=True)
    plot_evolution(iaf_neuron, single_current)


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

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


.. _sphx_glr_download_auto_examples_layers_plot_iaf.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_iaf.py <plot_iaf.py>`

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

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


.. only:: html

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

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