diff --git a/paddle/fluid/operators/recurrent_op.cc b/paddle/fluid/operators/recurrent_op.cc index fbacd0aa61d946f97dbe7487fee9128f2b90d81a..88c968a0eaae8a2ac6f14ede9348c837bcd92d76 100644 --- a/paddle/fluid/operators/recurrent_op.cc +++ b/paddle/fluid/operators/recurrent_op.cc @@ -623,11 +623,8 @@ class RecurrentGradOpShapeInference : public framework::InferShapeBase { std::vector input{kInputs, kInitialStates}; std::vector output{kOutputs}; for (auto &s : input) { - PADDLE_ENFORCE(ctx->HasInputs(s)); // NOTE(zcd): In some case, some of kInputs doesn't have gradient. - // PADDLE_ENFORCE(ctx->HasOutputs(framework::GradVarName(s)), - // "Cannot find the gradient variable %s", - // framework::GradVarName(s)); + PADDLE_ENFORCE(ctx->HasInputs(s)); } for (auto &s : output) { PADDLE_ENFORCE(ctx->HasInputs(s));