From 41b9f01e4c935eef3662a6a58a7ab7fd0de13041 Mon Sep 17 00:00:00 2001 From: Yang Chen <40417152+yangchen-MS@users.noreply.github.com> Date: Tue, 12 Nov 2019 00:47:13 -0800 Subject: [PATCH] test bidaf with nuphar for avx target (#2370) increase nuphar test coverage a bit --- .../test/python/onnxruntime_test_python_nuphar.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/onnxruntime/test/python/onnxruntime_test_python_nuphar.py b/onnxruntime/test/python/onnxruntime_test_python_nuphar.py index 6bd7d33fa3..46415e5399 100644 --- a/onnxruntime/test/python/onnxruntime_test_python_nuphar.py +++ b/onnxruntime/test/python/onnxruntime_test_python_nuphar.py @@ -55,15 +55,21 @@ class TestNuphar(unittest.TestCase): else: os.makedirs(cache_dir) - nuphar_settings = 'nuphar_cache_path:{}'.format(cache_dir) - onnxrt.capi._pybind_state.set_nuphar_settings(nuphar_settings) - # prepare feed feed = {} for i in range(4): tp = onnx.load_tensor(os.path.join(bidaf_dir, 'test_data_set_0', 'input_{}.pb'.format(i))) feed[tp.name] = numpy_helper.to_array(tp) + # force codegen_target to be avx + nuphar_settings = 'nuphar_codegen_target:avx' + onnxrt.capi._pybind_state.set_nuphar_settings(nuphar_settings) + sess = onnxrt.InferenceSession(bidaf_int8_scan_only_model) + assert 'NupharExecutionProvider' in sess.get_providers() + output = sess.run([], feed) + + nuphar_settings = 'nuphar_cache_path:{}'.format(cache_dir) + onnxrt.capi._pybind_state.set_nuphar_settings(nuphar_settings) sess = onnxrt.InferenceSession(bidaf_int8_scan_only_model) # JIT cache happens when initializing session assert 'NupharExecutionProvider' in sess.get_providers() output = sess.run([], feed)