TensorRT – Invalid Node – TopK,This version of TensorRT only supports input K as an initializer
1 This version of TensorRT only supports input K as an initializer
今天使用TensorRT-8.5.1.7的trtexec工具转换onnx模型为trt模型时出现了以下错误:
[04/27/2023-09:04:12] [E] [TRT] ModelImporter.cpp:729: --- End node ---
[04/27/2023-09:04:12] [E] [TRT] ModelImporter.cpp:732: ERROR: ModelImporter.cpp:168 In function parseGraph:
[6] Invalid Node - TopK_573
This version of TensorRT only supports input K as an initializer. Try applying constant folding on the model using Polygraphy: https://github.com/NVIDIA/TensorRT/tree/master/tools/Polygraphy/examples/cli/surgeon/02_folding_constants
[04/27/2023-09:04:12] [E] Failed to parse onnx file
从错误信息上看,是TopK算子没有找到,然后TensorRT给的建议是使用它的Polygraphy工具对Onnx模型进行constant folding。
之后我按照https://github.com/NVIDIA/TensorRT/tree/master/tools/Polygraphy/examples/cli/surgeon/02_folding_constants配置了Polygraphy工具的环境,并对onnx模型进行了constant folding操作,再次进行转换还是出现了问题。
2 问题解决方法
目前TensorRT版本已经到了8.6.0的预览版,我从8.6.0版本的官方文档https://docs.nvidia.com/deeplearning/tensorrt/archives/index.html#trt_8 看到了其的算子支持是包含TopK的,然后我使用了最新的8.6.0预览版本8.6.0.12重新对原始的onnx模型进行转换,竟然成功了。
然后我看8.5.3的文档,里面竟然也是支持TopK算子的,然后我又重新使用了8.5.3对原始的onnx模型进行了转换,但是在解析模型时同样出现了TopK算子有错的信息。
这真是令人费解。
不过以后遇到TensorRT转换Onnx模型出现算子不支持的情况,首先应该查看最新TensorRT的算子支持列表,查看是否有这个算子,避免浪费太多时间。
本文作者:StubbornHuang
版权声明:本文为站长原创文章,如果转载请注明原文链接!
原文标题:TensorRT – Invalid Node – TopK,This version of TensorRT only supports input K as an initializer
原文链接:https://www.stubbornhuang.com/2596/
发布于:2023年04月27日 9:33:26
修改于:2023年04月27日 9:34:45
当前分类随机文章推荐
- TensorRT - Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors 阅读589次,点赞0次
- TensorRT - Using PreviewFeaturekFASTER_DYNAMIC_SHAPES_0805 can help improve performance and resolve potential functional issues 阅读1002次,点赞0次
- TensorRT - 使用torch普通算子组合替代torch.einsum爱因斯坦求和约定算子的一般性方法 阅读3478次,点赞3次
- TensorRT - 解决INVALID_ARGUMENT: getPluginCreator could not find plugin ScatterND version 1,TensorRT找不到ScatterND插件的问题 阅读5121次,点赞0次
- TensorRT - onnx_graphsurgeon工具库的安装与API简介 阅读1909次,点赞0次
- TensorRT - 安装TensorRT工具Polygraphy 阅读5352次,点赞0次
- TensorRT - 使用C++ SDK出现无法解析的外部符号 "class sample::Logger sample::gLogger"错误 阅读672次,点赞0次
- TensortRT - 转换模型出现Could not locate zlibwapi.dll. Please make sure it is in your library path!错误 阅读1181次,点赞0次
- TensorRT - 使用Polygraphy工具比较onnx模型和TensorRT模型的推理结果是否一致 阅读1184次,点赞1次
- TensorRT - 喜大普奔,TensorRT8.2 EA起开始支持Einsum爱因斯坦求和算子 阅读1993次,点赞0次
全站随机文章推荐
- Alphapose - 在Alphapose中使用yolov3-tiny检测器大幅提升检测性能 阅读3089次,点赞0次
- C++ - 使用标准库std::use_facet和std::codecvt进行跨平台gbk与utf8字符集转换 阅读487次,点赞0次
- Pytorch - torch.nn.Conv2d参数详解与使用 阅读1219次,点赞0次
- 杂谈 - 2022年度总结 阅读564次,点赞0次
- WordPress - WordPress升级5.8之后获取最新评论的代码失效问题解决 阅读1809次,点赞0次
- C++ - 获取std::vector中的最小值、最大值以及对应的索引 阅读489次,点赞0次
- C++ - 字节数组byte[]或者unsigned char[]与double的相互转换 阅读2932次,点赞0次
- 资源分享 - Character Animation With Direct3D 英文高清PDF下载 阅读2263次,点赞1次
- 资源分享 - Game AI Pro 360 - Guide to Movement and Pathfinding 英文高清PDF下载 阅读2122次,点赞0次
- WordPress - 在浏览器的console输出信息 阅读4231次,点赞0次
评论
169