Skip to content

Commit

Permalink
fix a bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcy-seso committed Aug 23, 2017
1 parent bc6bae8 commit 377401f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions paddle/gserver/layers/SequenceSliceLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ void SequenceSliceLayer::copySliceIdsToCpu() {

void SequenceSliceLayer::calSelectedRows(const MatrixPtr starts,
const MatrixPtr ends) {
CHECK(starts && ends);
CHECK(starts || ends) << "At least one of the start or end indices "
<< "should be given.";

outSeqStartPos_.resize(1, 0);
outSubSeqStartPos_.resize(1, 0);
Expand All @@ -148,7 +149,7 @@ void SequenceSliceLayer::calSelectedRows(const MatrixPtr starts,
if (ends) endPos = inputSeqInfoVec_[i][j] + ends->getElement(rowIdx, k);

int seqLen = endPos - begPos + 1;
CHECK_LT(seqLen, 0U);
CHECK_GT(seqLen, 0U);
for (int m = begPos; m <= endPos; ++m) selectedRows_.push_back(m);
inputSeqInfoVec_.size() > 1
? outSubSeqStartPos_.push_back(outSubSeqStartPos_.back() + seqLen)
Expand Down

0 comments on commit 377401f

Please sign in to comment.