[5] Assertion failed: tensors.count(input_name)

what does this mean?


Input filename: D:\software\TensorRT-6.0.1.5\data\ainno\ts.onnx
ONNX IR version: 0.0.4
Opset version: 11
Producer name: pytorch
Producer version: 1.3
Domain:
Model version: 0
Doc string:

WARNING: ONNX model has a newer ir_version (0.0.4) than this parser was built against (0.0.3).
While parsing node number 0 [Conv]:
ERROR: ModelImporter.cpp:296 In function importModel:
[5] Assertion failed: tensors.count(input_name)

Hi,

I think this error comes from the ONNX parser having an issue parsing your graph, specifically that it found a node with no input I believe.

There are a few things you can try for this:

  1. It seems that PyTorch 1.3 is a little more up to date than the current parsers (opset 11), so that may be the root cause for now. You can try downgrading to 1.2 just for exporting your Pytorch to ONNX, see here: https://github.com/onnx/onnx-tensorrt/issues/302

  2. You can try inspecting your graph with the ONNX python library to see if it gives you any hints to the issue:

import onnx
onnx.checker.check_model(onnx_model)
  1. You can visually inspect your graph using something like https://lutzroeder.github.io/netron/ to see if anything looks wrong with the graph.

  2. One user even tried changing the parser code, so there may be some helpful things here, but I don’t think that is necessary: https://github.com/onnx/onnx-tensorrt/issues/199

@OP I’m also trying to get this to work - I’ll update you. Are you exporting a ResNet-50?

Update: This works on PyTorch 1.2.0 - downgrading to that should work. However, if you’re looking to do any upsampling op as part of your export to ONNX, you’re going to have some trouble.

1 Like

Any more recent updates on this? I’m seeing the same problem, I need to use pytorch 1.4 for an unrelated reason but building a trt engine from the resulting onnx files fails because of this error.