MCPcopy Create free account
hub / github.com/andrewkchan/deepseek.cpp / sample_argmax

Method sample_argmax

src/sampler.cpp:28–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28int Sampler::sample_argmax(const InferenceState& s) {
29 const float* logits = s.logits();
30 int argmax = 0;
31 float max_val = -FLT_MAX;
32 for (int i = 0; i < vocab_size; ++i) {
33 if (logits[i] > max_val) {
34 max_val = logits[i];
35 argmax = i;
36 }
37 }
38 return argmax;
39}
40
41int Sampler::sample(const InferenceState& s, float temperature, float top_p) {
42 if (temperature == 0.0) {

Callers

nothing calls this directly

Calls 1

logitsMethod · 0.80

Tested by

no test coverage detected