diff --git a/paddle/fluid/operators/recurrent_op.cc b/paddle/fluid/operators/recurrent_op.cc
index efc3ba056f1a2151ddfa96305cca7dc2bc73f2f6..43c724e91b23b8e8dad796d3899c696dd491a3f5 100644
--- a/paddle/fluid/operators/recurrent_op.cc
+++ b/paddle/fluid/operators/recurrent_op.cc
@@ -121,7 +121,7 @@ int64_t RecurrentBase::GetSequenceLength(const framework::Scope &scope) const {
   // Dim format SEQ_LEN, BATCH_SIZE, ...
   int64_t seq_len = -1;
   auto &all_inputs = Inputs(kInputs);
-  PADDLE_ENFORCE_EQ(!all_inputs.empty(), true);
+  PADDLE_ENFORCE_EQ(all_inputs.empty(), false);
   for (auto &iname : all_inputs) {
     auto *var = scope.FindVar(iname);
     PADDLE_ENFORCE_NOT_NULL(var);