未验证 提交 21277904 编写于 作者: W wanghuancoder 提交者: GitHub

Weight and bias's stop_gradient of BatchNorm must be True or False at the same time (#47634)

上级 52a34649
...@@ -605,6 +605,14 @@ void BatchNormGradRawKernel(const Context &ctx, ...@@ -605,6 +605,14 @@ void BatchNormGradRawKernel(const Context &ctx,
"the dimensions of input is [%s]", "the dimensions of input is [%s]",
x_dims.size(), x_dims.size(),
x_dims)); x_dims));
PADDLE_ENFORCE_EQ((d_scale == nullptr && d_bias == nullptr) ||
(d_scale != nullptr && d_bias != nullptr),
true,
phi::errors::InvalidArgument(
"Weight and bias's stop_gradient of BatchNorm must be "
"True or False at the same time."));
int N, C, H, W, D; int N, C, H, W, D;
phi::funcs::ExtractNCWHD(x_dims, data_layout, &N, &C, &H, &W, &D); phi::funcs::ExtractNCWHD(x_dims, data_layout, &N, &C, &H, &W, &D);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册