Layer of `leaky integrate-and-fire (LIF) neurons `_.
| 416 | |
| 417 | |
| 418 | class LIFNodes(Nodes): |
| 419 | # language=rst |
| 420 | """ |
| 421 | Layer of `leaky integrate-and-fire (LIF) neurons |
| 422 | <http://web.archive.org/web/20190318204706/http://icwww.epfl.ch/~gerstner/SPNM/node26.html#SECTION02311000000000000000>`_. |
| 423 | """ |
| 424 | |
| 425 | def __init__( |
| 426 | self, |
| 427 | n: Optional[int] = None, |
| 428 | shape: Optional[Iterable[int]] = None, |
| 429 | traces: bool = False, |
| 430 | traces_additive: bool = False, |
| 431 | tc_trace: Union[float, torch.Tensor] = 20.0, |
| 432 | trace_scale: Union[float, torch.Tensor] = 1.0, |
| 433 | sum_input: bool = False, |
| 434 | thresh: Union[float, torch.Tensor] = -52.0, |
| 435 | rest: Union[float, torch.Tensor] = -65.0, |
| 436 | reset: Union[float, torch.Tensor] = -65.0, |
| 437 | refrac: Union[int, torch.Tensor] = 5, |
| 438 | tc_decay: Union[float, torch.Tensor] = 100.0, |
| 439 | lbound: float = None, |
| 440 | **kwargs, |
| 441 | ) -> None: |
| 442 | # language=rst |
| 443 | """ |
| 444 | Instantiates a layer of LIF neurons. |
| 445 | |
| 446 | :param n: The number of neurons in the layer. |
| 447 | :param shape: The dimensionality of the layer. |
| 448 | :param traces: Whether to record spike traces. |
| 449 | :param traces_additive: Whether to record spike traces additively. |
| 450 | :param tc_trace: Time constant of spike trace decay. |
| 451 | :param trace_scale: Scaling factor for spike trace. |
| 452 | :param sum_input: Whether to sum all inputs. |
| 453 | :param thresh: Spike threshold voltage. |
| 454 | :param rest: Resting membrane voltage. |
| 455 | :param reset: Post-spike reset voltage. |
| 456 | :param refrac: Refractory (non-firing) period of the neuron. |
| 457 | :param tc_decay: Time constant of neuron voltage decay. |
| 458 | :param lbound: Lower bound of the voltage. |
| 459 | """ |
| 460 | super().__init__( |
| 461 | n=n, |
| 462 | shape=shape, |
| 463 | traces=traces, |
| 464 | traces_additive=traces_additive, |
| 465 | tc_trace=tc_trace, |
| 466 | trace_scale=trace_scale, |
| 467 | sum_input=sum_input, |
| 468 | ) |
| 469 | |
| 470 | self.register_buffer( |
| 471 | "rest", torch.tensor(rest, dtype=torch.float) |
| 472 | ) # Rest voltage. |
| 473 | self.register_buffer( |
| 474 | "reset", torch.tensor(reset, dtype=torch.float) |
| 475 | ) # Post-spike reset voltage. |
no outgoing calls