braintools.spike.bitwise_iand#
- braintools.spike.bitwise_iand(x, y)#
Perform a bitwise IAND (Inverse AND) operation on spike tensors.
This function computes the Inverse AND (IAND) operation between two spike tensors. IAND is defined as
(NOT x) AND y.- Parameters:
- Returns:
The element-wise IAND of the inputs, with their broadcast shape.
- Return type:
Array|ndarray|bool|number|bool|int|float|complex|Quantity
Notes
This operation is implemented using the formula
(1 - x) * y, which is equivalent to the IAND 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 >>> x = jnp.array([0, 0, 1, 1]) >>> y = jnp.array([0, 1, 0, 1]) >>> braintools.spike.bitwise_iand(x, y) Array([0, 1, 0, 0], dtype=int32)