提交 69e92b39 编写于 作者: Y Yancey1989

add an enforce

上级 ad477b91
...@@ -65,7 +65,8 @@ class SequenceConcatOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -65,7 +65,8 @@ class SequenceConcatOpMaker : public framework::OpProtoAndCheckerMaker {
"If the level is 0, the inputs will be joined at the nested " "If the level is 0, the inputs will be joined at the nested "
"sequence level." "sequence level."
"If the level is 1, the inputs will be joined at the " "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); .SetDefault(0);
AddComment(R"DOC( AddComment(R"DOC(
The sequence_concat operator concatenates multiple LoDTensors. The sequence_concat operator concatenates multiple LoDTensors.
......
...@@ -77,6 +77,9 @@ class SequenceConcatOpKernel : public framework::OpKernel<T> { ...@@ -77,6 +77,9 @@ class SequenceConcatOpKernel : public framework::OpKernel<T> {
"LoDTensors should be the same."); "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<T>(ctx.GetPlace()); out->mutable_data<T>(ctx.GetPlace());
auto out_lod = concatLoD<LoDTensor>(ins, axis, level); auto out_lod = concatLoD<LoDTensor>(ins, axis, level);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册