# TensoRT ONNX parser

**URL:** <https://forums.developer.nvidia.com/t/tensort-onnx-parser/120832>\
**Category:** TensorRT\
**Tags:** tensorrt\
**Created:** [April 23, 2020, 6:07pm UTC](https://forums.developer.nvidia.com/t/tensort-onnx-parser/120832 "2020-04-23T18:07:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FelipeVW](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/felipevw/32/17218_2.png) [@FelipeVW](https://forums.developer.nvidia.com/u/FelipeVW)\
**Post date:** [April 23, 2020, 6:07pm UTC](https://forums.developer.nvidia.com/t/tensort-onnx-parser/120832/1 "2020-04-23T18:07:43Z")

</div>

Hi,

I am trying to import the Faster RCNN model from the onnx zoo to tensorRT.

> [https://github.com/onnx/models/tree/master/vision/object\_detection\_segmentation/faster-rcnn](https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/faster-rcnn)

My system specifications are:

- Windows 10
- CUDA 10.1
- TensorRT 6.0.1.5
- ONNX model version: 1.5 Opset version: 10

I found several issues in the model parsing I would like to discuss.  
Firstly, my sample code:

```
// Create the inference builder
IBuilder* builder = createInferBuilder(gLogger);

// Create the network definition
INetworkDefinition* network = builder->createNetwork();

nvonnxparser::IParser* parser = nvonnxparser::createParser(*network, gLogger);

// what is the verbosity
size_t verbosity{};
parser->parseFromFile(DEPLOY_FILE, verbosity);

if (!parser->parse(DEPLOY_FILE, verbosity))
{
    std::cout << "Failed to parse onnx file." << std::endl;
    return nullptr;
}

```

With this code I recieve an error like that:

> WARNING: ONNX model has a newer ir\_version (0.0.4) than this parser was built against (0.0.3).  
> ERROR: Parameter check failed at: Network.cpp::nvinfer1::Network::addInput::671, condition: isValidDims(dims, hasImplicitBatchDimension())  
> ERROR: ModelImporter.cpp:80 In function importInput:  
> [8] Assertion failed: \*tensor = importer\_ctx-\>network()-\>addInput( input.name().c\_str(), trt\_dtype, trt\_dims)  
> Inference returned: 1

Continuing this thread [TensorRT onnx parser](https://forums.developer.nvidia.com/t/tensorrt5-onnx-parser-api-issue/67163), when reading the documentation of TensorRT6 and TensorRT7, if feel like it is mixed. Specifically in section 2.2.5 Importing An ONNX Model Using The C++ ParserAPI.  
Is there a mix between functions?

> nvonnxparser::IONNXParser\* parser = nvonnxparser::createONNXParser(_network, gLogger); // TensorRT6  
> nvonnxparser::IParser_ parser = nvonnxparser::createParser(\*network, gLogger); // TensorRT7  
> [https://docs.nvidia.com/deeplearning/sdk/pdf/TensorRT-Developer-Guide.pdf](https://docs.nvidia.com/deeplearning/sdk/pdf/TensorRT-Developer-Guide.pdf)  
> [https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/tensorrt-601/pdf/TensorRT-Developer-Guide.pdf](https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/tensorrt-601/pdf/TensorRT-Developer-Guide.pdf)

What are my options, should I upgrade to tensorRT 7? I find a lot of comments with error compatibilities with onnx. Any kind of suggestion is more than welcomed but I believe the documentation should be more thorough on the version compatibility.

Thank you for your time

---

<div class="post-metadata">

**Author:** ![SunilJB](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/suniljb/32/14043_2.png) [@SunilJB](https://forums.developer.nvidia.com/u/SunilJB)\
**Post date:** [April 24, 2020, 10:02am UTC](https://forums.developer.nvidia.com/t/tensort-onnx-parser/120832/2 "2020-04-24T10:02:33Z")

</div>

I will recommend you to try latest TRT version.  
Also, please use ONNX opset 11 to generate your model.

Thank

---

<div class="post-metadata">

**Author:** ![NVES\_R](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves_r/32/14043_2.png) [@NVES\_R](https://forums.developer.nvidia.com/u/NVES_R)\
**Post date:** [April 24, 2020, 6:24pm UTC](https://forums.developer.nvidia.com/t/tensort-onnx-parser/120832/3 "2020-04-24T18:24:34Z")

</div>

> Continuing this thread [TensorRT onnx parser](https://forums.developer.nvidia.com/t/tensorrt5-onnx-parser-api-issue/67163), when reading the documentation of TensorRT6 and TensorRT7, if feel like it is mixed. Specifically in section 2.2.5 Importing An ONNX Model Using The C++ ParserAPI.  
> Is there a mix between functions?

`nvonnxparser::IParser* parser = nvonnxparser::createParser(*network, gLogger);` is correct, I believe the former `nvonnxparser::createONNXParser` you found was from TensorRT \<= 5.0, and was outdated in TRT6 docs and fixed in TRT7 docs.
