提交 3b03e374 编写于 作者: Y yangyaming

Refine some ENFORCE.

上级 58730ba1
...@@ -49,7 +49,7 @@ class SequenceExpandOp : public framework::OperatorWithKernel { ...@@ -49,7 +49,7 @@ class SequenceExpandOp : public framework::OperatorWithKernel {
auto& y_lod = y_var->Get<LoDTensor>().lod(); auto& y_lod = y_var->Get<LoDTensor>().lod();
PADDLE_ENFORCE_LE(x_lod.size(), 1, PADDLE_ENFORCE_LE(x_lod.size(), 1,
"Number of lod level of Input(X) should not be " "Level number of Input(X)'s lod should not be "
"greater than 1."); "greater than 1.");
PADDLE_ENFORCE_GT(y_lod.size(), 0, PADDLE_ENFORCE_GT(y_lod.size(), 0,
"Level number of Input(Y)'s lod should be " "Level number of Input(Y)'s lod should be "
...@@ -64,11 +64,10 @@ class SequenceExpandOp : public framework::OperatorWithKernel { ...@@ -64,11 +64,10 @@ class SequenceExpandOp : public framework::OperatorWithKernel {
if (ref_level == -1) ref_level = y_lod.size() - 1; if (ref_level == -1) ref_level = y_lod.size() - 1;
if (x_lod.size() > 0) { if (x_lod.size() > 0) {
PADDLE_ENFORCE( PADDLE_ENFORCE(x_lod[0].size() == y_lod[ref_level].size(),
x_lod.size() == 0 || x_lod[0].size() == y_lod[ref_level].size(), "Level number of Input(X)'s lod could be 0. Otherwise "
"Level number of Input(X)'s lod should be 0. Otherwise "
"size of Input(X)'s first level lod should be equal to " "size of Input(X)'s first level lod should be equal to "
"size of Input(Y)'s lod of referred level."); "size of Input(Y)'s referred level lod.");
} }
int64_t out_first_dim = 0; int64_t out_first_dim = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册