Function dfdx::tensor_ops::bool_or

source ·
pub fn bool_or<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 ‘or’.

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, true]);
assert_eq!(r2.array(), [false, true, true, true]);

And-ing with a scalar:

let a = dev.tensor([false, true, false]);

let r1 = &a | true;
let r2 = &a | false;

assert_eq!(r1.array(), [true; 3]);
assert_eq!(r2.array(), a.array());