common : add llama_batch_add() and llama_batch_clear() helpers

This commit is contained in:
Georgi Gerganov
2023-10-16 12:41:33 +03:00
parent 005949109d
commit 360a333145
10 changed files with 98 additions and 122 deletions
+1 -1
View File
@@ -9342,7 +9342,7 @@ struct llama_batch llama_batch_get_one(
}
struct llama_batch llama_batch_init(int32_t n_tokens, int32_t embd, int32_t n_seq_max) {
llama_batch batch = { -1, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0, };
llama_batch batch = { 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0, };
if (embd) {
batch.embd = (float *) malloc(sizeof(float) * n_tokens * embd);