| 365 | } |
| 366 | |
| 367 | void llama_sampler_free(struct llama_sampler * smpl) { |
| 368 | if (smpl == nullptr) { |
| 369 | return; |
| 370 | } |
| 371 | |
| 372 | if (smpl->iface->free) { |
| 373 | smpl->iface->free(smpl); |
| 374 | } |
| 375 | |
| 376 | delete smpl; |
| 377 | } |
| 378 | |
| 379 | llama_token llama_sampler_sample(struct llama_sampler * smpl, struct llama_context * ctx, int32_t idx) { |
| 380 | const auto * logits = llama_get_logits_ith(ctx, idx); |