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

Method sampleTopPFromProb

web/src/runtime.ts:1564–1566  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 1

randomFloatMethod · 0.80

Tested by

no test coverage detected