SpikeBitwise

Contents

SpikeBitwise#

class brainstate.nn.SpikeBitwise(op='add', name=None)#

Bitwise addition for the spiking inputs.

\[\begin{split}\begin{array}{ccc} \hline \text { Mode } & \text { Expression for } \mathrm{g}(\mathrm{x}, \mathrm{y}) & \text { Code for } \mathrm{g}(\mathrm{x}, \mathrm{y}) \\ \hline \text { ADD } & x+y & x+y \\ \text { AND } & x \cap y & x \cdot y \\ \text { IAND } & (\neg x) \cap y & (1-x) \cdot y \\ \text { OR } & x \cup y & (x+y)-(x \cdot y) \\ \hline \end{array}\end{split}\]
Parameters:
  • op (str) – The bitwise operation. Default: ‘add’

  • name (str | None) – The name of the dynamic system.

Examples

>>> import brainstate.nn as nn
>>> m = nn.SpikeBitwise(op='and')
>>> x = brainstate.random.randn(2, 3) > 0
>>> y = brainstate.random.randn(2, 3) > 0
>>> output = m(x, y)