MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / get_sampled_probs_ith

Method get_sampled_probs_ith

subprojects/llama.cpp/src/llama-context.cpp:831–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829}
830
831float * llama_context::get_sampled_probs_ith(int32_t idx) {
832 output_reorder();
833
834 if (sampling.probs == nullptr) {
835 return nullptr;
836 }
837
838 try {
839 const int64_t row = output_resolve_row(idx);
840 if ((size_t) row >= sampling.probs_count.size() || sampling.probs_count[row] == 0) {
841 return nullptr;
842 }
843 return sampling.probs + row*model.vocab.n_tokens();
844 } catch (const std::exception & err) {
845 LLAMA_LOG_ERROR("%s: invalid backend sampled probs id %d, reason: %s\n", __func__, idx, err.what());
846 return nullptr;
847 }
848}
849
850float * llama_context::get_sampled_logits_ith(int32_t idx) {
851 output_reorder();

Callers 1

Calls 3

sizeMethod · 0.65
n_tokensMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected