isclose#
Determine the closeness of values across two operators using absolute and relative tolerances. The output
from isclose is an int
value since it’s commonly used for reductions and bool
reductions using
atomics are not available in hardware.
-
template<typename Op1, typename Op2>
__MATX_INLINE__ auto matx::isclose(const Op1 &op1, const Op2 &op2, double rtol = 1e-5, double atol = 1e-8)# Returns an integer tensor where an element is 1 if: abs(op1 - op2) <= atol + rtol * abs(op2)
or 0 otherwise
- Template Parameters:
Op1 – First operator type
Op2 – Second operator type
- Parameters:
op1 – First operator
op2 – Second operator
rtol – Relative tolerance
atol – Absolute tolerance
- Returns:
IsClose operator
Examples#
auto A = make_tensor<TestType>({5, 5, 5});
auto B = make_tensor<TestType>({5, 5, 5});
auto C = make_tensor<int>({5, 5, 5});
(A = ones<TestType>(A.Shape())).run(exec);
(B = ones<TestType>(B.Shape())).run(exec);
(C = isclose(A, B)).run(exec);