MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / get_sample_from_population

Function get_sample_from_population

benchmarks/cpp/utils/utils.py:144–151  ·  view source on GitHub ↗
(population_range, sample_size)

Source from the content-addressed store, hash-verified

142def gen_random_tokens(ip_lens, tokenizer, random_seed):
143
144 def get_sample_from_population(population_range, sample_size):
145 # random.sample can not sample a value more than once. hence the check
146 if sample_size < len(population_range):
147 sample = random.sample(population_range, sample_size)
148 else:
149 sample = random.choices(population_range, k=sample_size)
150
151 return sample
152
153 input_ids = []
154 random.seed(random_seed)

Callers 1

gen_random_tokensFunction · 0.70

Calls 2

choicesMethod · 0.80
sampleMethod · 0.45

Tested by

no test coverage detected