未验证 提交 b4a500bc 编写于 作者: R Ryan 提交者: GitHub

[phi] add register of is_finite (#51322)

* add isfinite

* add isnan & isinf

* add xpu isNaN
上级 15689eac
......@@ -81,7 +81,6 @@ static std::set<std::string> OpsNeedSetOutputDtypeWhenRegisterPhiKernel = {
"histogram",
"instance_norm",
"is_empty",
"is_finite",
"kthvalue",
"lamb",
"layer_norm",
......
......@@ -26,7 +26,9 @@ PD_REGISTER_KERNEL(isinf,
double,
phi::dtype::float16,
int,
int64_t) {}
int64_t) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
PD_REGISTER_KERNEL(isnan,
CPU,
......@@ -36,7 +38,9 @@ PD_REGISTER_KERNEL(isnan,
double,
phi::dtype::float16,
int,
int64_t) {}
int64_t) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
PD_REGISTER_KERNEL(isfinite,
CPU,
......@@ -46,4 +50,6 @@ PD_REGISTER_KERNEL(isfinite,
double,
phi::dtype::float16,
int,
int64_t) {}
int64_t) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
......@@ -26,7 +26,9 @@ PD_REGISTER_KERNEL(isinf,
double,
phi::dtype::float16,
int,
int64_t) {}
int64_t) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
PD_REGISTER_KERNEL(isnan,
GPU,
......@@ -36,7 +38,9 @@ PD_REGISTER_KERNEL(isnan,
double,
phi::dtype::float16,
int,
int64_t) {}
int64_t) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
PD_REGISTER_KERNEL(isfinite,
GPU,
......@@ -46,4 +50,6 @@ PD_REGISTER_KERNEL(isfinite,
double,
phi::dtype::float16,
int,
int64_t) {}
int64_t) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
......@@ -34,4 +34,6 @@ void IsnanKernel(const Context& ctx, const DenseTensor& x, DenseTensor* out) {
} // namespace phi
PD_REGISTER_KERNEL(
isnan, XPU, ALL_LAYOUT, phi::IsnanKernel, float, phi::dtype::float16) {}
isnan, XPU, ALL_LAYOUT, phi::IsnanKernel, float, phi::dtype::float16) {
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册