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

Function load_test_case

samples/python/onnx_custom_plugin/sample.py:92–107  ·  view source on GitHub ↗
(inputs, context_text, query_text, trt_context)

Source from the content-addressed store, hash-verified

90 return engine
91
92def load_test_case(inputs, context_text, query_text, trt_context):
93 # Part 1: Specify Input shapes
94 cw, cc = preprocess(context_text)
95 qw, qc = preprocess(query_text)
96 for arr in (cw, cc, qw, qc):
97 assert arr.shape[0] <= MAX_TEXT_LENGTH, "Input context or query is too long! " + \
98 "Either decrease the input length or increase MAX_TEXT_LENGTH"
99 trt_context.set_input_shape('CategoryMapper_4', cw.shape)
100 trt_context.set_input_shape('CategoryMapper_5', cc.shape)
101 trt_context.set_input_shape('CategoryMapper_6', qw.shape)
102 trt_context.set_input_shape('CategoryMapper_7', qc.shape)
103
104 # Part 2: load input data
105 cw_flat, cc_flat, qw_flat, qc_flat = get_inputs(context_text, query_text)
106 for i, arr in enumerate([cw_flat, cc_flat, qw_flat, qc_flat]):
107 inputs[i].host = arr
108
109
110def main():

Callers 1

mainFunction · 0.85

Calls 2

preprocessFunction · 0.90
get_inputsFunction · 0.90

Tested by

no test coverage detected