MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llama_log_softmax

Function llama_log_softmax

llama.cpp:8477–8489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8475}
8476
8477static void llama_log_softmax(float * array, size_t size) {
8478 float max_l = *std::max_element(array, array + size);
8479 float sum = 0.f;
8480 for (size_t i = 0; i < size; ++i) {
8481 float p = expf(array[i] - max_l);
8482 sum += p;
8483 array[i] = p;
8484 }
8485
8486 for (size_t i = 0; i < size; ++i) {
8487 array[i] = logf(array[i] / sum);
8488 }
8489}
8490
8491void llama_sample_classifier_free_guidance(
8492 struct llama_context * ctx,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected