| 130 | } |
| 131 | |
| 132 | static std::vector<size_t> build_hypothesis(const StorageView& history, |
| 133 | const dim_t batch, |
| 134 | const dim_t beam, |
| 135 | const dim_t start, |
| 136 | const dim_t end) { |
| 137 | const auto* ids = history.index<int32_t>({batch, beam, 0}); |
| 138 | return std::vector<size_t>(ids + start, ids + end); |
| 139 | } |
| 140 | |
| 141 | static std::vector<std::vector<float>> build_attention(const StorageView& history, |
| 142 | const dim_t batch, |