| 829 | } |
| 830 | |
| 831 | float * 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 | |
| 850 | float * llama_context::get_sampled_logits_ith(int32_t idx) { |
| 851 | output_reorder(); |
no test coverage detected