provider - onnxruntime with use_dml mix build hanppen error 使用 DML 执行提供程序时不支持启用内存模式
问题描述
在窗口环境中,使用--use_dml 在nxruntime 上构建,我的命令是“
.\build.bat --update --build --build_shared_lib --build_wheel --config RelWithDebInfo --use_dml --cmake_generator "Visual Studio 16 2019" --parallel --skip_tests".
最终构建成功,生成whl文件。然后
pip3 install *.whl
.so我可以使用python进行推理。但是发生了错误。我的代码是“
session_1 = onnxruntime.InferenceSession(model_path,options)"
错误是“2021-03-10 19:03:59.3618026 [W:onnxruntime:, inference_session.cc:411 onnxruntime::InferenceSession::RegisterExecutionProvider] 使用 DML 执行提供程序时不支持启用内存模式。所以禁用它用于此会话,因为它使用 DML 执行提供程序。” 而且推理时间很长。谁能告诉我为什么?
解决方案
根据文档(https://onnxruntime.ai/docs/execution-providers/DirectML-ExecutionProvider.html#configuration-options),声明会话时应使用以下两个参数:
options.enable_mem_pattern = False
options.execution_mode = rt.ExecutionMode.ORT_SEQUENTIAL
推荐阅读
- cloudera - 在 Impala 中转换为上午/下午
- c - ¿ 在 c 中将 bmp 旋转 90 度?
- c++ - 为什么我的信号处理程序只执行一次?
- c# - 为每个冒号“:”拆分长字符串并按位置获取行的索引
- javascript - 更改 DIV 内空输入的边框颜色
- java - 在Java中实现一个数组旋转方法
- visual-studio-code - 如何在文件资源管理器视图中编辑项目的样式
- r - CSV 导入的数据表不能用于直方图
- radio-button - 在带有 taghelpers 的 ASP.NET Core MVC 中输入单选按钮
- vue.js - v-for 循环仅显示最近上传的内容