llama : simplify returns if/else branches
This commit is contained in:
parent
4ad0676927
commit
e9463792d3
1 changed files with 6 additions and 18 deletions
24
llama.cpp
24
llama.cpp
|
@ -7380,12 +7380,8 @@ int llama_eval(
|
||||||
llama_kv_cache_tokens_rm(ctx->kv_self, n_past, -1);
|
llama_kv_cache_tokens_rm(ctx->kv_self, n_past, -1);
|
||||||
|
|
||||||
const int ret = llama_decode_internal(*ctx, llama_batch_get_one(tokens, n_tokens, n_past, 0), n_threads);
|
const int ret = llama_decode_internal(*ctx, llama_batch_get_one(tokens, n_tokens, n_past, 0), n_threads);
|
||||||
if (ret != 0) {
|
if (ret < 0) {
|
||||||
if (ret < 0) {
|
LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret);
|
||||||
LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -7402,12 +7398,8 @@ int llama_eval_embd(
|
||||||
llama_batch batch = { n_tokens, nullptr, embd, nullptr, nullptr, nullptr, n_past, 1, 0, };
|
llama_batch batch = { n_tokens, nullptr, embd, nullptr, nullptr, nullptr, n_past, 1, 0, };
|
||||||
|
|
||||||
const int ret = llama_decode_internal(*ctx, batch, n_threads);
|
const int ret = llama_decode_internal(*ctx, batch, n_threads);
|
||||||
if (ret != 0) {
|
if (ret < 0) {
|
||||||
if (ret < 0) {
|
LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret);
|
||||||
LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -7460,12 +7452,8 @@ int llama_decode(
|
||||||
struct llama_batch batch,
|
struct llama_batch batch,
|
||||||
int n_threads) {
|
int n_threads) {
|
||||||
const int ret = llama_decode_internal(*ctx, batch, n_threads);
|
const int ret = llama_decode_internal(*ctx, batch, n_threads);
|
||||||
if (ret != 0) {
|
if (ret < 0) {
|
||||||
if (ret < 0) {
|
LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret);
|
||||||
LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue