未验证 提交 a445c335 编写于 作者: Y Yiqun Liu 提交者: GitHub

Add the check of lod in sequence_softmax kernel. (#18996)

* Add the check of lod in sequence_softmax kernel.
test=develop

* Refine the comments.
test=develop
上级 2175d199
......@@ -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.");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册