def create_example_test_directory(): # fill in the inputs that we want to use specific values for input_data = {} input_data["K"] = np.asarray([64]).astype(np.int64) # provide symbolic dim values as needed symbolic_dim_values = {"batch": 25, "items": 256} # create the directory. random input will be created for any missing inputs. # the model will be run and the output will be saved as expected output for future runs ort_test_dir_utils.create_test_dir("topk.onnx", "PerfTests", "test1", input_data, symbolic_dim_values)
def run_backend_ort(model_path, test_data_set=None): # if 'test_data_set_N' doesn't exist, create test_dir if not test_data_set: onnxruntime.InferenceSession(model_path) ort_test_dir_utils.create_test_dir(model_path, './', test_utils.TEST_ORT_DIR) ort_test_dir_utils.run_test_dir(test_utils.TEST_ORT_DIR) # otherwise use the existing 'test_data_set_N' as test data else: test_dir_from_tar = test_utils.get_model_directory(model_path) ort_test_dir_utils.run_test_dir(test_dir_from_tar) # remove the produced test_dir from ORT test_utils.remove_onnxruntime_test_dir()
def run_backend_ort(model_path, test_data_set=None): model = onnx.load(model_path) if model.opset_import[0].version < 7: print( 'Skip ORT test since it only *guarantees* support for models stamped with opset version 7' ) return # if 'test_data_set_N' doesn't exist, create test_dir if not test_data_set: onnxruntime.InferenceSession(model_path) ort_test_dir_utils.create_test_dir(model_path, './', test_utils.TEST_ORT_DIR) ort_test_dir_utils.run_test_dir(test_utils.TEST_ORT_DIR) # otherwise use the existing 'test_data_set_N' as test data else: test_dir_from_tar = test_utils.get_model_directory(model_path) ort_test_dir_utils.run_test_dir(test_dir_from_tar) # remove the produced test_dir from ORT test_utils.remove_onnxruntime_test_dir()