Function dfdx::tensor_ops::nans_to
source · [−]Expand description
Replaces any std::f32::NAN with value
.
Pytorch equivalent: t.nan_to_num(value)
Example:
let t: Tensor1D<4> = Tensor1D::new([1.0, f32::NAN, f32::NAN, 4.0]);
let r = t.nans_to(0.0);
assert_eq!(r.data(), &[1.0, 0.0, 0.0, 4.0]);