Skip to content

Commit d98dc01

Browse files
malfetfacebook-github-bot
authored andcommitted
Fix compilation with gcc-9+ (#3262)
Summary: To fix `cannot resolve overloaded function ‘isinf’ based on conversion to type ‘torch::executor::FunctionRef<bool(double)>’` error Not sure how it ever worked before see https://godbolt.org/z/939YKdjqW Pull Request resolved: #3262 Reviewed By: kimishpatel, manuelcandales Differential Revision: D56501235 Pulled By: malfet fbshipit-source-id: 6f89beef9fd56a80ecbb2df573821da95b2da746
1 parent ba0caf8 commit d98dc01

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

kernels/portable/cpu/op_isinf.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace executor {
1515
namespace native {
1616

1717
Tensor& isinf_out(RuntimeContext& ctx, const Tensor& in, Tensor& out) {
18-
return internal::unary_ufunc_realhb_to_bool(std::isinf, ctx, in, out);
18+
return internal::unary_ufunc_realhb_to_bool(
19+
static_cast<bool (*)(double)>(std::isinf), ctx, in, out);
1920
}
2021

2122
} // namespace native

kernels/portable/cpu/op_isnan.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace executor {
1515
namespace native {
1616

1717
Tensor& isnan_out(RuntimeContext& ctx, const Tensor& in, Tensor& out) {
18-
return internal::unary_ufunc_realhb_to_bool(std::isnan, ctx, in, out);
18+
return internal::unary_ufunc_realhb_to_bool(
19+
static_cast<bool (*)(double)>(std::isnan), ctx, in, out);
1920
}
2021

2122
} // namespace native

0 commit comments

Comments
 (0)