braintools.spike.bitwise_ixor#
- braintools.spike.bitwise_ixor(x, y)#
Perform a bitwise IXOR (Inverse XOR) operation on spike tensors.
This function computes the Inverse XOR (IXOR) operation between two spike tensors. IXOR is defined as
(x AND NOT y) OR (NOT x AND y), which equals XOR on binary values.- Parameters:
- Returns:
The element-wise IXOR 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
x * (1 - y) + (1 - x) * y, which is equivalent to the IXOR 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_ixor(x, y) Array([0, 1, 1, 0], dtype=int32)