Add `Append` method to `AllQueries`

This commit is contained in:
RangerUFO 2025-06-16 20:39:27 +08:00
parent e5c81f64a1
commit 7aac765e96
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) {