allclose#

Reduce the closeness of two operators to a single scalar (0D) output. The output from allclose is an int value since boolean reductions are not available in hardware

template<typename OutType, typename InType1, typename InType2>
void __MATX_INLINE__ matx::allclose(OutType dest, const InType1 &in1, const InType2 &in2, double rtol, double atol, HostExecutor exec)#

Find if all values are != 0

Returns a boolean value indicating whether all values in the set of inputs are non-zero. The same aggregation rules apply for input vs output tensor size and what type of reduction is done.

Template Parameters:
  • OutType – Output data type

  • InType – Input data type

Parameters:
  • dest – Destination view of output boolean

  • in1 – First input data to compare

  • in2 – Second input data to compare

  • rtol – Relative tolerance for comparison

  • atol – Absolute tolerance for comparison

  • exec – Single threaded host executor

template<typename OutType, typename InType1, typename InType2>
void __MATX_INLINE__ matx::allclose(OutType dest, const InType1 &in1, const InType2 &in2, double rtol, double atol, cudaExecutor exec = 0)#

Find if all values are != 0

Returns a boolean value indicating whether all values in the set of inputs are non-zero. The same aggregation rules apply for input vs output tensor size and what type of reduction is done.

Template Parameters:
  • OutType – Output data type

  • InType – Input data type

Parameters:
  • dest – Destination view of output boolean

  • in1 – First input data to compare

  • in2 – Second input data to compare

  • rtol – Relative tolerance for comparison

  • atol – Absolute tolerance for comparison

  • exec – CUDA executor or stream ID

Examples#

auto A = make_tensor<TestType>({5, 5, 5});
auto B = make_tensor<TestType>({5, 5, 5});
auto C = make_tensor<int>({});

(A = ones<TestType>(A.Shape())).run(exec);
(B = ones<TestType>(B.Shape())).run(exec);
allclose(C, A, B, 1e-5, 1e-8, exec);