MCPcopy Create free account
hub / github.com/apache/tvm / sampleTopPFromLogits

Method sampleTopPFromLogits

web/src/runtime.ts:1553–1555  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 1

randomFloatMethod · 0.80

Tested by

no test coverage detected