class sinabs.layers.NeuromorphicReLU(quantize=True, fanout=1, stochastic_rounding=False)[source]#

NeuromorphicReLU layer. This layer is NOT used for Sinabs networks; it’s useful while training analogue pyTorch networks for future use with Sinabs.

  • quantize – Whether or not to quantize the output (i.e. floor it to the integer below), in order to mimic spiking behavior.

  • fanout – Useful when computing the number of SynOps of a quantized NeuromorphicReLU. The activity can be accessed through NeuromorphicReLU.activity, and is multiplied by the value of fanout.

  • stochastic_rounding – Upon quantization, should the value be rounded stochastically or floored

  • mode (Only done during training. During evaluation)

  • floored (the value is simply)


Define the computation performed at every call.

Should be overridden by all subclasses.


Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.