braintools.spike.bitwise_not#
- braintools.spike.bitwise_not(x)#
Perform a bitwise NOT operation on spike tensors.
This function computes the NOT operation on a spike tensor. The NOT operation inverts the binary values in the tensor.
- Parameters:
x (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – The input spike tensor.- Returns:
The element-wise NOT of the input, with the same shape.
- Return type:
Array|ndarray|bool|number|bool|int|float|complex|Quantity
See also
bitwise_iand(NOT x) AND y.
Notes
This operation is implemented using the formula
1 - x, which is equivalent to the NOT operation for binary values. Boolean inputs give a boolean result (computed with the logical functions); numeric inputs use the arithmetic formula, which keeps the dtype and stays differentiable for surrogate-gradient spikes.Examples
>>> import jax.numpy as jnp >>> import braintools >>> braintools.spike.bitwise_not(jnp.array([0, 0, 1, 1])) Array([1, 1, 0, 0], dtype=int32) >>> >>> braintools.spike.bitwise_not(jnp.array([False, False, True, True])) Array([ True, True, False, False], dtype=bool)