fn
bitwise_not
→Tensorbitwise_not(input: Tensor)Element-wise bitwise NOT.
Inverts every bit of each integer entry. For boolean tensors this reduces to
logical negation (logical_not).
Parameters
inputTensorInput tensor. Must have integer or boolean dtype.
Returns
TensorTensor with the same shape and dtype as input, with every bit flipped.
Notes
For a signed two's-complement integer x of width bits:
Not differentiable; gradients are dropped.
Examples
>>> import lucid
>>> x = lucid.tensor([0, 1, -1], dtype=lucid.int32)
>>> lucid.bitwise_not(x)
Tensor([-1, -2, 0])