| 89 | bool BatchDecoder::is_eos(int t) const { return std::find(eos_.begin(), eos_.end(), t) != eos_.end(); } |
| 90 | |
| 91 | void BatchDecoder::fit(const std::vector<BatchLane*>& lanes) { |
| 92 | if ((int) lanes.size() > MAXT) throw std::runtime_error("batch decoder: more lanes than a window's rows"); |
| 93 | for (;;) { |
| 94 | int rows = 0; |
| 95 | BatchLane* most = nullptr; |
| 96 | for (BatchLane* L : lanes) { |
| 97 | rows += L->rows(); |
| 98 | if (!most || L->drafts.size() > most->drafts.size()) most = L; |
| 99 | } |
| 100 | if (rows <= MAXT) return; |
| 101 | most->cut(most->rows() - 1); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | int BatchDecoder::draft_one(BatchLane& L, int T, bool from_main, int src_row, const std::vector<int>& toks, int pos0, |
| 106 | const std::vector<int>& pen_seq, Dist& q) { |