Function dfdx::tensor_ops::bool_and

source ·
pub fn bool_and<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 ‘and’.

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