diff --git a/paddle/fluid/operators/expand_op.cc b/paddle/fluid/operators/expand_op.cc index 526c053b5b501dc20f58e0cd3376fe6c08006f14..eef238302217156665ae93397cd4cc0e9410d9e5 100644 --- a/paddle/fluid/operators/expand_op.cc +++ b/paddle/fluid/operators/expand_op.cc @@ -116,6 +116,10 @@ class ExpandGradOp : public framework::OperatorWithKernel { size_t start_pos = 0u; if (!ctx->IsRuntime()) { + PADDLE_ENFORCE_EQ( + x_dims[i], out_dims[i], + "The first dimension size of Input(Out@GRAD) should be " + "equal to the crroresponding dimension size of Input(X)"); start_pos = 1u; }