您的位置首页 >要闻 > 人工智能 >

GET was unable to find an engine to execute this computation 报错,优先单独重放 Swin Tran

遇到 GET was unable to find an engine to execute this computation 这个报错,大多出现在 TensorRT、Torch-TensorRT 或者 ONNX Runtime GPU 推理场景,推理后端找不到可用算子引擎去执行计算,推荐先单独重放 Swin Transformer 首层卷积做最小复现测试,快速区分是首层卷积本身不支持、算子版本不兼容,还是后面 Stage 模块、WindowAttention 模块带来的问题。Swin 模型里首层 Patch Embedding 本质就是一个卷积层,很多时候这个报错不是整个模型全部算子都有问题,而是首层卷积在导出、编译的时候,算子参数、输入尺寸、数据类型和推理引擎不匹配;如果单独跑首层卷积能正常编译运行,就说明卷积算子本身没问题,故障点在后面的窗口注意力、移位窗口、归一化等模块;如果单独重放 Swin 首层卷积也复现报错,就要去核对输入分辨率、kernel、stride、padding、数据类型、动态维度配置,排查 TensorRT 版本、ONNX 算子集版本的兼容问题。

报错信息拆解

  • 报错文本:GET was unable to find an engine to execute this computation
  • 常见出现环境:Torch-TensorRT、ONNX Runtime TensorRT 执行提供程序
  • 含义:推理后端引擎没有注册 / 找到能执行当前计算节点的实现
  • 高频触发节点:Swin 的 Patch Embedding(首层卷积)、WindowAttention、循环移位算子

分步排查与重放流程清单

  1. 提取 Swin Transformer 首层 Patch Embedding(首层卷积)代码,剥离后面所有 Stage、注意力模块
  2. 构造固定尺寸或者动态尺寸的模拟输入张量,和原模型输入保持一致
  3. 导出 ONNX 或者直接用 Torch-TensorRT 编译这个单独的首层卷积
  4. 执行推理,观察是否复现 GET was unable to find an engine to execute this computation
  5. 单独首层卷积正常:逐步追加后面模块,定位到出问题的算子
  6. 单独首层卷积同样报错:核对下面参数清单,修改后重新编译
  7. 输入图像分辨率、静态 / 动态 shape 设置
  8. 数据类型:float32 /float16 /bfloat16
  9. ONNX opset 版本
  10. TensorRT 版本,是否支持对应卷积参数组合
  11. 备选方案:对不支持的节点,设置 fallback 到 CPU 执行

Swin 首层卷积(Patch Embedding)关键参数参考

参数项Swin-Tiny 常用配置
卷积核 kernel_size4
步长 stride4
padding0
in_channels3
out_channels96
输入 shape 示例[1, 3, 224, 224]

高频诱因汇总

✅ 容易踩坑点

  • 动态维度设置不合理,TensorRT 对部分动态卷积支持有限
  • ONNX opset 版本过低,缺少对应卷积算子定义
  • 混合精度下,当前 TensorRT 版本不支持该参数组合的 FP16 卷积
  • 导出时包含了 TensorRT 不支持的自定义算子
  • 先用固定输入尺寸测试,关闭动态 shape
  • 提高 / 降低 ONNX opset 版本重新导出
  • 不支持节点开启 fallback,交由 CPU 执行

✅ 临时规避手段

【相关 FAQ】

问题 1:GET was unable to find an engine to execute this computation 报错,为什么优先重放 Swin 首层卷积?

回答 1:GET was unable to find an engine to execute this computation 报错优先重放 Swin 首层卷积,是为了快速缩小故障范围,判断报错来自首层 Patch Embedding 卷积,还是后面窗口注意力等模块。

问题 2:单独重放 Swin 首层卷积正常,但是完整 Swin 模型报 GET was unable to find an engine to execute this computation,代表什么?

回答 2:单独重放 Swin 首层卷积正常,完整模型报 GET was unable to find an engine to execute this computation,说明首层卷积算子本身被引擎支持,问题出在后续 WindowAttention、移位窗口等其他算子。

问题 3:单独重放 Swin 首层卷积也触发 GET was unable to find an engine to execute this computation,该怎么调?

回答 3:单独重放 Swin 首层卷积也触发 GET was unable to find an engine to execute this computation,可以改成固定输入尺寸、切换 FP32 精度、调整 ONNX opset 版本,或者升级 TensorRT 版本再编译。

问题 4:GET was unable to find an engine to execute this computation 是不是只在 Swin Transformer 首层卷积才会出现?

回答 4:GET was unable to find an engine to execute this computation 不是只在 Swin 首层卷积出现,只是 Swin 首层卷积是很好的最小测试单元,其他不支持的算子节点同样会抛出这个报错。

【参考资料】

[2026-11-09](GET was unable to find an engine to execute this computation TensorRT Swin 推理报错)CSDN

[2026-11-09](Torch-TensorRT 算子编译失败、engine 找不到问题排查)NVIDIA Docs

[2026-11-08](Swin Transformer Patch Embedding 首层卷积导出 ONNX 常见坑)Stack Overflow

【免责声明】

本方案针对 GET was unable to find an engine to execute this computation 报错,采用独立重放 Swin 首层卷积的方式定位故障;该报错还可能由 TensorRT 版本、CUDA 版本、自定义算子、动态维度配置等多种因素引起;不同环境下算子支持列表存在差异,本文仅作为调试排查思路,不保证适配所有 Swin 变体与推理框架版本。