问题:
在使用onnxruntime-gpu版本进行推理的时候,出现了如下警告:
2022-11-01 11:30:22.7315395 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {800,10} does not match actual shape of {2970,10} for output 500
2022-11-01 11:30:22.7383666 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {800,4} does not match actual shape of {2970,4} for output 497
2022-11-01 11:30:22.7449671 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {800,1} does not match actual shape of {2970,1} for output 494
2022-11-01 11:30:22.7675723 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {3200,10} does not match actual shape of {11880,10} for output 477
t match actual shape of {288,4} for output 4742022-11-01 11:30:23.0143680 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {3200,1} does not match actual shape of {288,1} for output 4712022-11-01 11:30:23.0292759 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {12800,10} does not match actual shape of {1152,10} for output 4542022-11-01 11:30:23.0350097 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {12800,4} does not match actual shape of {1152,4} for output 4512022-11-01 11:30:23.0410754 [W:onnxruntime:, execution_frame.cc:812 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {12800,1} does not match actual shape of {1152,1} for output 448
每次都警告很烦,因此一直在找如何屏蔽掉onnx的警告
方法:
onnxruntime.set_default_logger_severity(3)
只需要加入一句代码即可解决。