Skip to content

Commit

Permalink
Check if the number of input OPs in the model matches the number of i…
Browse files Browse the repository at this point in the history
…nputs in the test data
  • Loading branch information
PINTO0309 committed May 14, 2022
1 parent 4474b45 commit 63dc062
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sit4onnx/onnx_inference_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ def inference(
) for ort_input_name, ort_input_shape, onnx_input_type in zip(ort_input_names, ort_input_shapes, onnx_input_types)
}
else:
# Check if the number of input OPs in the model matches the number of inputs in the test data
if len(ort_input_names) != len(numpy_ndarrays_for_testing):
print(
f'{Color.RED}ERROR:{Color.RESET} '+
f'The number of input OPs in the model must match the number of test data inputs.\n'+
f'Number of model input OPs: {len(ort_input_names)}\n'+
f'Number of test data inputs: {len(numpy_ndarrays_for_testing)}'
)
sys.exit(1)
input_dict = {
ort_input_name: numpy_ndarray_for_testing \
for ort_input_name, numpy_ndarray_for_testing in zip(ort_input_names, numpy_ndarrays_for_testing)
Expand Down

0 comments on commit 63dc062

Please sign in to comment.