diff --git a/kernels/portable/cpu/op_isinf.cpp b/kernels/portable/cpu/op_isinf.cpp index 49db65dfcc8..068f402c07d 100644 --- a/kernels/portable/cpu/op_isinf.cpp +++ b/kernels/portable/cpu/op_isinf.cpp @@ -15,8 +15,10 @@ namespace executor { namespace native { Tensor& isinf_out(RuntimeContext& ctx, const Tensor& in, Tensor& out) { + // Lambda is syntactic sugar needed to workaround compilation on some older + // non-compatible distros where isnan is returning int rather than bool return internal::unary_ufunc_realhb_to_bool( - static_cast(std::isinf), ctx, in, out); + [](double x) -> bool { return std::isinf(x); }, ctx, in, out); } } // namespace native diff --git a/kernels/portable/cpu/op_isnan.cpp b/kernels/portable/cpu/op_isnan.cpp index 52857990904..09fb4f5f8ac 100644 --- a/kernels/portable/cpu/op_isnan.cpp +++ b/kernels/portable/cpu/op_isnan.cpp @@ -15,8 +15,10 @@ namespace executor { namespace native { Tensor& isnan_out(RuntimeContext& ctx, const Tensor& in, Tensor& out) { + // Lambda is syntactic sugar needed to workaround compilation on some older + // non-compatible distros where isnan is returning int rather than bool return internal::unary_ufunc_realhb_to_bool( - static_cast(std::isnan), ctx, in, out); + [](double x) -> bool { return std::isnan(x); }, ctx, in, out); } } // namespace native