Merge pull request #612 from ufownl:feature/allqueries_append

PiperOrigin-RevId: 772007208
This commit is contained in:
Copybara-Service 2025-06-16 06:52:43 -07:00
commit 2128d076db
1 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,8 @@ struct PerQuery {
// Array of `PerQuery`. Referenced by `QBatch` and passed to `GenerateBatch`.
struct AllQueries {
AllQueries() = default;
// For `GenerateSingleT`: same prompt/pos, replicated for each KV cache.
AllQueries(const PromptTokens& prompt, size_t pos, size_t prefix_end,
const hwy::Span<KVCache>& kv_caches) {
@ -97,6 +99,9 @@ struct AllQueries {
}
}
void Reserve(size_t size) { per_query_.reserve(size); }
void Append(const PerQuery& query) { per_query_.push_back(query); }
size_t NumQueries() const { return per_query_.size(); }
PerQuery& operator[](size_t query_idx) {