From bc69a9a6d030442e86cdfd22e488ccbc5387aee2 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Sun, 19 Jul 2026 21:15:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20duplicate=20argmax=5Fv=20?= =?UTF-8?q?=E2=80=94=20use=20NaN-safe=20version=20from=20sample.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/colibri.c | 5 ----- c/sample.h | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/c/colibri.c b/c/colibri.c index 554a7fa..03eb878 100644 --- a/c/colibri.c +++ b/c/colibri.c @@ -3481,11 +3481,6 @@ static void mtp_absorb(Model *m, const int *next_ids, const float *x, int S, int free(hx); free(cat); free(e); free(hn); free(hf); free(nrm); free(tmp); } -static inline int argmax_v(const float *lo, int V){ - int b=-1; float bv=-INFINITY; - for(int i=0;ibv){ bv=x; b=i; } } - return b<0?0:b; -} static void repin_pass_limit(Model *m,int limit); static void repin_pass(Model *m){ repin_pass_limit(m,16); } diff --git a/c/sample.h b/c/sample.h index abce88c..26db529 100644 --- a/c/sample.h +++ b/c/sample.h @@ -17,9 +17,9 @@ static inline double rndu(void){ /* ---- argmax over a float vector ----------------------------------------- */ static inline int argmax_v(const float *lo, int V){ - int b = 0; float bv = lo[0]; - for (int i = 1; i < V; i++) if (lo[i] > bv) { bv = lo[i]; b = i; } - return b; + int b=-1; float bv=-INFINITY; + for(int i=0;ibv){ bv=x; b=i; } } + return b<0?0:b; } /* ---- distribution buffers (reused, single-threaded decode) --------------- */