MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / forward

Method forward

bindsnet/network/nodes.py:371–395  ·  view source on GitHub ↗

Runs a single simulation step. :param x: Inputs to the layer.

(self, x: torch.Tensor)

Source from the content-addressed store, hash-verified

369 self.lbound = lbound # Lower bound of voltage.
370
371 def forward(self, x: torch.Tensor) -> None:
372 # language=rst
373 """
374 Runs a single simulation step.
375
376 :param x: Inputs to the layer.
377 """
378 # Integrate input voltages.
379 self.v += (self.refrac_count <= 0).float() * x
380
381 # Decrement refractory counters.
382 self.refrac_count -= self.dt
383
384 # Check for spiking neurons.
385 self.s = self.v >= self.thresh
386
387 # Refractoriness and voltage reset.
388 self.refrac_count.masked_fill_(self.s, self.refrac)
389 self.v.masked_fill_(self.s, self.reset)
390
391 # Voltage clipping to lower bound.
392 if self.lbound is not None:
393 self.v.masked_fill_(self.v < self.lbound, self.lbound)
394
395 super().forward(x)
396
397 def reset_state_variables(self) -> None:
398 # language=rst

Callers

nothing calls this directly

Calls 1

forwardMethod · 0.45

Tested by

no test coverage detected