解决onnxruntime警告问题

问题:

在使用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)

只需要加入一句代码即可解决。

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
### 回答1: ONNX Runtime是一个开源的跨平台推理引擎,它可以在各种硬件和软件平台上运行机器学习模型。ONNX是开放神经网络交换格式的缩写,它是一种用于表示机器学习模型的开放标准格式。ONNX Runtime可以解析和执行ONNX格式的模型,使得模型可以在多种硬件和软件平台上高效地运行。ONNX Runtime支持多种编程语言,包括C++、Python、C#、Java等。 ### 回答2: ONNX Runtime是一个开源的高性能、跨平台的推理引擎,用于执行深度学习模型的推理。ONNX是开放神经网络交换的缩写,它是由微软、Facebook和亚马逊等公司合作开发的一个开源项目。ONNX Runtime支持多种硬件和操作系统,可以在各种设备上运行,包括桌面、云服务器和嵌入式设备。 ONNX Runtime的主要功能是加载、优化和执行深度学习模型。用户可以使用ONNX Runtime来加载不同框架(如PyTorch、TensorFlow等)训练得到的模型,并在不同的硬件上进行推理。ONNX Runtime使用性能优化技术,如图优化、模型融合和多线程计算,以提高推理速度和效率。 ONNX Runtime的另一个重要功能是模型的可扩展性和灵活性。它支持动态图和静态图,可以处理各种类型的模型,包括深度学习模型、传统机器学习模型和自定义模型。此外,ONNX Runtime还提供了一组丰富的API,方便用户进行推理过程中的输入输出数据处理。 总的来说,ONNX Runtime是一个强大的深度学习推理引擎,具有高性能、跨平台和可扩展的特点。它提供了一个统一的接口,让用户可以灵活地在不同的硬件上进行深度学习模型的推理,从而加速模型部署和应用的开发。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值