1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9 #include <executorch/kernels/portable/cpu/pattern/pattern.h> 10 #include <executorch/runtime/kernel/kernel_includes.h> 11 #include <cmath> 12 13 namespace torch { 14 namespace executor { 15 namespace native { 16 isinf_out(KernelRuntimeContext & ctx,const Tensor & in,Tensor & out)17Tensor& isinf_out(KernelRuntimeContext& ctx, const Tensor& in, Tensor& out) { 18 // Lambda is syntactic sugar needed to workaround compilation on some older 19 // non-compatible distros where isnan is returning int rather than bool 20 return internal::unary_ufunc_realhb_to_bool( 21 [](double x) -> bool { return std::isinf(x); }, ctx, in, out); 22 } 23 24 } // namespace native 25 } // namespace executor 26 } // namespace torch 27