* Sample index via top-p sampling. * * @param prob The distribution, i.e. logits after `applySoftmaxWithTemperature()` is performed. * @param top_p The top_p * @returns The sampled index.
(prob: Tensor, top_p: number)
| 1562 | * @returns The sampled index. |
| 1563 | */ |
| 1564 | sampleTopPFromProb(prob: Tensor, top_p: number): number { |
| 1565 | return this.ctx.sampleTopPFromProb(prob, top_p, this.rng.randomFloat()); |
| 1566 | } |
| 1567 | |
| 1568 | /** |
| 1569 | * Apply repetition penalty to the logits. |
nothing calls this directly
no test coverage detected