[−][src]Function autograd::ops::equal
pub fn equal<T: Float, A: AsRef<Tensor<T>>, B: AsRef<Tensor<T>>>(
a: A,
b: B
) -> Tensor<T>
Compares two tensors and returns a binary tensor.
if a[i] == b[i]
then return-value[i]
will be 1 else 0
Panics
When broadcast is impossible
extern crate ndarray; extern crate autograd as ag; let ref a = ag::constant(ndarray::arr1(&[1., 2., 3.])); let ref b = ag::constant(ndarray::arr1(&[3., 2., 1.])); let ref c = ag::equal(a, b); assert_eq!(c.eval(&[]), Some(ndarray::arr1(&[0., 1., 0.]).into_dyn()));