Skip to content

Commit

Permalink
Add the check of lod in sequence_softmax kernel. (PaddlePaddle#18996)
Browse files Browse the repository at this point in the history
* Add the check of lod in sequence_softmax kernel.
test=develop

* Refine the comments.
test=develop
  • Loading branch information
Xreki authored Aug 6, 2019
1 parent 2175d19 commit a445c33
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions paddle/fluid/operators/sequence_ops/sequence_softmax_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ class SequenceSoftmaxKernel : public framework::OpKernel<T> {
auto dims = x->dims();

const size_t level = lod.size() - 1;
PADDLE_ENFORCE_GT(
lod.size(), 0U,
"The LoD level of Input X should be larger than 0 (lod.size() > 0).");
PADDLE_ENFORCE_EQ(dims[0], static_cast<int64_t>(lod[level].back()),
"The first dimension of Input(X) should be equal to the "
"sum of all sequences' lengths.");
Expand Down

0 comments on commit a445c33

Please sign in to comment.