Skip to content

Commit

Permalink
Remove merge_repeated option for TimeStepSeq
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleary committed Oct 27, 2017
1 parent 7b57219 commit 52a64a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions pytorch_ctc/src/ctc_beam_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ struct BeamEntry {
return labels;
}

std::vector<int> TimeStepSeq(bool merge_repeated) const {
std::vector<int> TimeStepSeq() const {
std::vector<int> time_steps;
int prev_label = -1;
const BeamEntry *c = this;
while (c->parent != nullptr) { // Checking c->parent to skip root leaf.
if (!merge_repeated || c->label != prev_label) {
time_steps.push_back(c->time_step);
}
time_steps.push_back(c->time_step);
prev_label = c->label;
c = c->parent;
}
Expand Down
2 changes: 1 addition & 1 deletion pytorch_ctc/src/ctc_beam_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Status CTCBeamSearchDecoder<CTCBeamState, CTCBeamComparer>::TopPaths(
BeamEntry* e((*branches)[i]);
paths->push_back(e->LabelSeq(merge_repeated));
log_probs->push_back(e->newp.total);
alignments->push_back(e->TimeStepSeq(merge_repeated));
alignments->push_back(e->TimeStepSeq());
}
return Status::OK();
}
Expand Down

0 comments on commit 52a64a8

Please sign in to comment.