(inputs, context_text, query_text, trt_context)
| 90 | return engine |
| 91 | |
| 92 | def 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 | |
| 110 | def main(): |
no test coverage detected