* Sample index via top-p sampling. * * @param logits The input logits before normalization. * @param temperature The temperature factor, will take argmax if temperature = 0.0 * @param top_p The top_p * @returns The sampled index.
(logits: Tensor, temperature: number, top_p: number)
| 1551 | * @returns The sampled index. |
| 1552 | */ |
| 1553 | sampleTopPFromLogits(logits: Tensor, temperature: number, top_p: number): number { |
| 1554 | return this.ctx.sampleTopPFromLogits(logits, temperature, top_p, this.rng.randomFloat()); |
| 1555 | } |
| 1556 | |
| 1557 | /** |
| 1558 | * Sample index via top-p sampling. |
nothing calls this directly
no test coverage detected