diff --git a/paddle/operators/sequence_concat_op.cc b/paddle/operators/sequence_concat_op.cc index c4d681bc852fb88d1a01471af88282cc1399bec8..3d19471618c6bfd4ac95b591f2c4bd7150cc3f90 100644 --- a/paddle/operators/sequence_concat_op.cc +++ b/paddle/operators/sequence_concat_op.cc @@ -65,7 +65,8 @@ class SequenceConcatOpMaker : public framework::OpProtoAndCheckerMaker { "If the level is 0, the inputs will be joined at the nested " "sequence level." "If the level is 1, the inputs will be joined at the " - "sequence level.") + "sequence level." + "The level should be less than the levels of input") .SetDefault(0); AddComment(R"DOC( The sequence_concat operator concatenates multiple LoDTensors. diff --git a/paddle/operators/sequence_concat_op.h b/paddle/operators/sequence_concat_op.h index b08699e1a1566179c05df3f3ccb10646307590e3..a197a05bbb881806b24f9dcce5282a4d972e3adc 100644 --- a/paddle/operators/sequence_concat_op.h +++ b/paddle/operators/sequence_concat_op.h @@ -77,6 +77,9 @@ class SequenceConcatOpKernel : public framework::OpKernel { "LoDTensors should be the same."); } } + PADDLE_ENFORCE_GT(ins[0]->NumLevels(), level, + "The levels of all the input LoDTensors " + "should be greater than the specify level"); out->mutable_data(ctx.GetPlace()); auto out_lod = concatLoD(ins, axis, level);