Layer of leaky integrate-and-fire (LIF) neurons with adaptive thresholds. A neuron's voltage threshold is increased by some constant each time it spikes; otherwise, it is decaying back to its default value.
| 827 | |
| 828 | |
| 829 | class AdaptiveLIFNodes(Nodes): |
| 830 | # language=rst |
| 831 | """ |
| 832 | Layer of leaky integrate-and-fire (LIF) neurons with adaptive thresholds. A neuron's voltage threshold is increased |
| 833 | by some constant each time it spikes; otherwise, it is decaying back to its default value. |
| 834 | """ |
| 835 | |
| 836 | def __init__( |
| 837 | self, |
| 838 | n: Optional[int] = None, |
| 839 | shape: Optional[Iterable[int]] = None, |
| 840 | traces: bool = False, |
| 841 | traces_additive: bool = False, |
| 842 | tc_trace: Union[float, torch.Tensor] = 20.0, |
| 843 | trace_scale: Union[float, torch.Tensor] = 1.0, |
| 844 | sum_input: bool = False, |
| 845 | rest: Union[float, torch.Tensor] = -65.0, |
| 846 | reset: Union[float, torch.Tensor] = -65.0, |
| 847 | thresh: Union[float, torch.Tensor] = -52.0, |
| 848 | refrac: Union[int, torch.Tensor] = 5, |
| 849 | tc_decay: Union[float, torch.Tensor] = 100.0, |
| 850 | theta_plus: Union[float, torch.Tensor] = 0.05, |
| 851 | tc_theta_decay: Union[float, torch.Tensor] = 1e7, |
| 852 | lbound: float = None, |
| 853 | **kwargs, |
| 854 | ) -> None: |
| 855 | # language=rst |
| 856 | """ |
| 857 | Instantiates a layer of LIF neurons with adaptive firing thresholds. |
| 858 | |
| 859 | :param n: The number of neurons in the layer. |
| 860 | :param shape: The dimensionality of the layer. |
| 861 | :param traces: Whether to record spike traces. |
| 862 | :param traces_additive: Whether to record spike traces additively. |
| 863 | :param tc_trace: Time constant of spike trace decay. |
| 864 | :param trace_scale: Scaling factor for spike trace. |
| 865 | :param sum_input: Whether to sum all inputs. |
| 866 | :param rest: Resting membrane voltage. |
| 867 | :param reset: Post-spike reset voltage. |
| 868 | :param thresh: Spike threshold voltage. |
| 869 | :param refrac: Refractory (non-firing) period of the neuron. |
| 870 | :param tc_decay: Time constant of neuron voltage decay. |
| 871 | :param theta_plus: Voltage increase of threshold after spiking. |
| 872 | :param tc_theta_decay: Time constant of adaptive threshold decay. |
| 873 | :param lbound: Lower bound of the voltage. |
| 874 | """ |
| 875 | super().__init__( |
| 876 | n=n, |
| 877 | shape=shape, |
| 878 | traces=traces, |
| 879 | traces_additive=traces_additive, |
| 880 | tc_trace=tc_trace, |
| 881 | trace_scale=trace_scale, |
| 882 | sum_input=sum_input, |
| 883 | ) |
| 884 | |
| 885 | self.register_buffer("rest", torch.tensor(rest)) # Rest voltage. |
| 886 | self.register_buffer("reset", torch.tensor(reset)) # Post-spike reset voltage. |
no outgoing calls
no test coverage detected