mirror of https://github.com/google/gemma.cpp.git
Merge pull request #612 from ufownl:feature/allqueries_append
PiperOrigin-RevId: 772007208
This commit is contained in:
commit
2128d076db
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue