MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / _get_best_indexes

Function _get_best_indexes

demo/BERT/helpers/data_processing.py:212–222  ·  view source on GitHub ↗

Get the n-best logits from a list.

(logits, n_best_size)

Source from the content-addressed store, hash-verified

210
211
212def _get_best_indexes(logits, n_best_size):
213 """Get the n-best logits from a list."""
214
215 index_and_score = sorted(enumerate(logits), key=lambda x: x[1], reverse=True)
216
217 best_indexes = []
218 for i in range(len(index_and_score)):
219 if i >= n_best_size:
220 break
221 best_indexes.append(index_and_score[i][0])
222 return best_indexes
223
224
225def get_final_text(pred_text, orig_text, do_lower_case):

Callers 1

get_predictionsFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected