未验证 提交 b1f1dd05 编写于 作者: C Chen Weihang 提交者: GitHub

polish xpu enforce msg, test=kunlun (#45749)

上级 8d4f2613
......@@ -183,13 +183,8 @@ void BatchNormGradKernel(const Context &dev_ctx,
C,
epsilon_data,
global_inv_std_data);
PADDLE_ENFORCE_EQ(r1,
XPU_SUCCESS,
phi::errors::External("XPU API(batch_norm_grad "
"CalculateInvVar function) "
"return wrong value[%d %s]",
r1,
XPUAPIErrorMsg[r1]));
PADDLE_ENFORCE_XDNN_SUCCESS(r1,
"batch_norm_grad CalculateInvVar function");
}
// Here is a trick, x is a const input,
......@@ -209,13 +204,7 @@ void BatchNormGradKernel(const Context &dev_ctx,
C,
H * W,
x.data<T>());
PADDLE_ENFORCE_EQ(r2,
XPU_SUCCESS,
phi::errors::External("XPU API(batch_norm_grad "
"CalculateInvBNY function) "
"return wrong value[%d %s]",
r2,
XPUAPIErrorMsg[r2]));
PADDLE_ENFORCE_XDNN_SUCCESS(r2, "batch_norm_grad CalculateInvBNY function");
}
int r3;
......@@ -263,12 +252,7 @@ void BatchNormGradKernel(const Context &dev_ctx,
bias_grad_data,
is_nchw);
}
PADDLE_ENFORCE_EQ(r3,
XPU_SUCCESS,
phi::errors::External("XPU API(batch_norm_grad) return "
"wrong value[%d %s]",
r3,
XPUAPIErrorMsg[r3]));
PADDLE_ENFORCE_XDNN_SUCCESS(r3, "batch_norm_grad");
}
} // namespace phi
......
......@@ -102,12 +102,7 @@ void BatchNormKernel(const Context& dev_ctx,
mean_out_data,
variance_out_data,
is_nchw);
PADDLE_ENFORCE_EQ(r,
xpu::Error_t::SUCCESS,
phi::errors::External(
"The batch_norm XPU API return wrong value[%d %s]",
r,
XPUAPIErrorMsg[r]));
PADDLE_ENFORCE_XDNN_SUCCESS(r, "batch_norm");
} else {
const auto* mean_data = mean.data<float>();
const auto* variance_data = variance.data<float>();
......@@ -124,13 +119,7 @@ void BatchNormKernel(const Context& dev_ctx,
mean_data,
variance_data,
is_nchw);
PADDLE_ENFORCE_EQ(
r,
xpu::Error_t::SUCCESS,
phi::errors::External(
"The batch_norm_infer XPU API return wrong value[%d %s]",
r,
XPUAPIErrorMsg[r]));
PADDLE_ENFORCE_XDNN_SUCCESS(r, "batch_norm_infer");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册