Skip to content

Commit c013397

Browse files
am17anggerganov
andauthored
refactor if statement
Co-authored-by: Georgi Gerganov <[email protected]>
1 parent d1d89e0 commit c013397

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/llama-context.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,14 +796,12 @@ int llama_context::encode(const llama_batch & batch_inp) {
796796
auto * t_embd = res->get_embd_pooled() ? res->get_embd_pooled() : res->get_embd();
797797

798798
// extract logits
799-
if (t_logits && n_outputs > 0) {
799+
if (logits && t_logits) {
800800
ggml_backend_t backend_res = ggml_backend_sched_get_tensor_backend(sched.get(), t_logits);
801801
GGML_ASSERT(backend_res != nullptr);
802802
GGML_ASSERT(logits != nullptr);
803803

804-
if (n_outputs) {
805-
ggml_backend_tensor_get_async(backend_res, t_logits, logits, 0, n_outputs*n_vocab*sizeof(float));
806-
}
804+
ggml_backend_tensor_get_async(backend_res, t_logits, logits, 0, n_tokens*n_vocab*sizeof(float));
807805
}
808806

809807
// extract embeddings

0 commit comments

Comments
 (0)