mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/67804 Improve readability of test logs by suppressing ort warnings logging for onnx related test. Reducing ONNX CI test log binary size: linux-xenial-py3.6-clang7-onnx-test1: 12443 KB -> 6958 KB linux-xenial-py3.6-clang7-onnx-test2: 16884 KB -> 5778 KB Test Plan: Imported from OSS Reviewed By: msaroufim Differential Revision: D32181308 Pulled By: malfet fbshipit-source-id: 11cf165dc212d061606590e96c08c6e021135f74 Co-authored-by: BowenBao<bowbao@microsoft.com>
This commit is contained in:
parent
ea60e7d559
commit
ead59b5ff3
|
|
@ -93,7 +93,11 @@ def convert_to_onnx(model, input=None, opset_version=9, do_constant_folding=True
|
|||
onnx_shape_inference=onnx_shape_inference)
|
||||
|
||||
# compute onnxruntime output prediction
|
||||
ort_sess = onnxruntime.InferenceSession(f.getvalue())
|
||||
so = onnxruntime.SessionOptions()
|
||||
# suppress ort warnings.
|
||||
# 0:Verbose, 1:Info, 2:Warning. 3:Error, 4:Fatal. Default is 2.
|
||||
so.log_severity_level = 3
|
||||
ort_sess = onnxruntime.InferenceSession(f.getvalue(), so)
|
||||
return ort_sess
|
||||
|
||||
|
||||
|
|
@ -359,6 +363,9 @@ class TestONNXRuntime(unittest.TestCase):
|
|||
ort_sess_opt.graph_optimization_level = \
|
||||
onnxruntime.GraphOptimizationLevel.ORT_ENABLE_EXTENDED if ort_optim_on else \
|
||||
onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL
|
||||
# suppress ort warnings.
|
||||
# 0:Verbose, 1:Info, 2:Warning. 3:Error, 4:Fatal. Default is 2.
|
||||
ort_sess_opt.log_severity_level = 3
|
||||
ort_sess = onnxruntime.InferenceSession(model_file_name, sess_options=ort_sess_opt)
|
||||
input_copy = copy.deepcopy(input)
|
||||
ort_outs = run_ort(ort_sess, input_copy)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user