| 395 | } |
| 396 | |
| 397 | struct llama_sampler * llama_sampler_clone(const struct llama_sampler * smpl) { |
| 398 | if (!smpl) { |
| 399 | return nullptr; |
| 400 | } |
| 401 | |
| 402 | if (smpl->iface->clone) { |
| 403 | return smpl->iface->clone(smpl); |
| 404 | } |
| 405 | |
| 406 | if (smpl->ctx == nullptr) { |
| 407 | return llama_sampler_init( |
| 408 | /* .iface = */ smpl->iface, |
| 409 | /* .ctx = */ nullptr |
| 410 | ); |
| 411 | } |
| 412 | |
| 413 | GGML_ABORT("the sampler does not support cloning"); |
| 414 | } |
| 415 | |
| 416 | void llama_sampler_free(struct llama_sampler * smpl) { |
| 417 | if (smpl == nullptr) { |
no test coverage detected