Function dfdx::tensor_ops::bool_xor
source · pub fn bool_xor<S: Shape, E: Dtype, D: Device<E>>(
lhs: &Tensor<S, bool, D>,
rhs: &Tensor<S, bool, D>
) -> Tensor<S, bool, D>
Expand description
Element wise and scalar boolean ‘xor’.
Example:
let a = dev.tensor([false, false, true, true]);
let b = dev.tensor([false, true, false, true]);
// Can take either references or owned values
let r1 = &a ^ &b;
let r2 = a ^ b;
assert_eq!(r1.array(), [false, true, true, false]);
assert_eq!(r2.array(), [false, true, true, false]);
And-ing with a scalar:
let a = dev.tensor([false, true, false]);
let r1 = &a ^ true;
let r2 = &a ^ false;
assert_eq!(r1.array(), (!&a).array());
assert_eq!(r2.array(), a.array());