Abstract base class method for a single simulation step. :param x: Inputs to the layer.
(self, x: torch.Tensor)
| 87 | |
| 88 | @abstractmethod |
| 89 | def forward(self, x: torch.Tensor) -> None: |
| 90 | # language=rst |
| 91 | """ |
| 92 | Abstract base class method for a single simulation step. |
| 93 | |
| 94 | :param x: Inputs to the layer. |
| 95 | """ |
| 96 | if self.traces: |
| 97 | # Decay and set spike traces. |
| 98 | self.x *= self.trace_decay |
| 99 | |
| 100 | if self.traces_additive: |
| 101 | self.x += self.trace_scale * self.s.float() |
| 102 | else: |
| 103 | self.x.masked_fill_(self.s.bool(), self.trace_scale) |
| 104 | |
| 105 | if self.sum_input: |
| 106 | # Add current input to running sum. |
| 107 | self.summed += x.float() |
| 108 | |
| 109 | def reset_state_variables(self) -> None: |
| 110 | # language=rst |
no outgoing calls
no test coverage detected