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

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

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