onnx / onnx-tensorrt

ONNX-TensorRT: TensorRT backend for ONNX
Apache License 2.0
2.96k stars 546 forks source link

-std=gnu++14 by default? And error: ‘::onnx2trt_onnx’ has not been declared #927

Closed jiapei100 closed 1 year ago

jiapei100 commented 1 year ago

Description

Environment

TensorRT Version: 8.6.1 ONNX-TensorRT Version / Branch: GPU Type: 3090 Nvidia Driver Version: NVIDIA-SMI 535.54.03 CUDA Version: 12.2 CUDNN Version: 8.9.3 Operating System + Version: Ubuntu 22.04 Python Version (if applicable): 3.10.6 TensorFlow + TF2ONNX Version (if applicable): 1.14.0 PyTorch Version (if applicable): N/A Baremetal or Container (if container which image + tag):

Relevant Files

N/A

Steps To Reproduce

  1. Built and successfully installed an external onnx, with a similar issue but solved by manually removing -std=gnu++14 but only keeping -std=c++17.
  2. Modified CMakeLists.txt line 75: from add_subdirectory(third_party/onnx EXCLUDE_FROM_ALL) to find_library(ONNX_LIBRARY NAMES onnx onnx_proto).
  3. Tried to build onnx-tensorrt, and obtain the whole bunch of ERRORs:
    
    [  3%] Building CXX object CMakeFiles/nvonnxparser.dir/NvOnnxParser.cpp.o
    /usr/bin/c++ -DONNX_NAMESPACE=onnx2trt_onnx -DSOURCE_LENGTH=81 -Dnvonnxparser_EXPORTS -I/usr/local/cuda/include -std=c++17 -fPIC -Wall -Wno-deprecated-declarations -Wno-unused-function -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/nvonnxparser.dir/NvOnnxParser.cpp.o -MF CMakeFiles/nvonnxparser.dir/NvOnnxParser.cpp.o.d -o CMakeFiles/nvonnxparser.dir/NvOnnxParser.cpp.o -c ....../onnx-tensorrt/NvOnnxParser.cpp
    ....../onnx-tensorrt/TensorOrWeights.hpp: In member function ‘bool onnx2trt::TensorOrWeights::isFp32() const’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:87:49: note: in expansion of macro ‘ONNX_NAMESPACE’
    87 |                            : _weights.type == ::ONNX_NAMESPACE::TensorProto_DataType_FLOAT;
      |                                                 ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/TensorOrWeights.hpp: In member function ‘bool onnx2trt::TensorOrWeights::isFp16() const’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:92:42: note: in expansion of macro ‘ONNX_NAMESPACE’
    92 |                     : _weights.type == ::ONNX_NAMESPACE::TensorProto_DataType_FLOAT16;
      |                                          ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/TensorOrWeights.hpp: In member function ‘bool onnx2trt::TensorOrWeights::isInt32() const’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:96:100: note: in expansion of macro ‘ONNX_NAMESPACE’
    96 |         return is_tensor() ? _tensor->getType() == nvinfer1::DataType::kINT32 : _weights.type == ::ONNX_NAMESPACE::TensorProto_DataType_INT32;
      |                                                                                                    ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/TensorOrWeights.hpp: In member function ‘bool onnx2trt::TensorOrWeights::isBool() const’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:100:99: note: in expansion of macro ‘ONNX_NAMESPACE’
    100 |         return is_tensor() ? _tensor->getType() == nvinfer1::DataType::kBOOL : _weights.type == ::ONNX_NAMESPACE::TensorProto_DataType_BOOL;
      |                                                                                                   ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/TensorOrWeights.hpp: In member function ‘std::string onnx2trt::TensorOrWeights::getType() const’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:125:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    125 |             case ::ONNX_NAMESPACE::TensorProto::DOUBLE: return "FLOAT";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:126:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    126 |             case ::ONNX_NAMESPACE::TensorProto::FLOAT: return "FLOAT";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:127:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    127 |             case ::ONNX_NAMESPACE::TensorProto::INT8: return "INT8";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:128:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    128 |             case ::ONNX_NAMESPACE::TensorProto::UINT8: return "UINT8";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:129:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    129 |             case ::ONNX_NAMESPACE::TensorProto::FLOAT16: return "HALF";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:130:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    130 |             case ::ONNX_NAMESPACE::TensorProto::BOOL: return "BOOL";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:131:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    131 |             case ::ONNX_NAMESPACE::TensorProto::INT32: return "INT32";
      |                    ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/TensorOrWeights.hpp:132:20: note: in expansion of macro ‘ONNX_NAMESPACE’
    132 |             case ::ONNX_NAMESPACE::TensorProto::INT64: return "INT32";
      |                    ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/onnx2trt.hpp: At global scope:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt.hpp:31:30: note: in expansion of macro ‘ONNX_NAMESPACE’
    31 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs)>
      |                              ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt.hpp:31:30: note: in expansion of macro ‘ONNX_NAMESPACE’
    31 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs)>
      |                              ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt.hpp:31:106: error: template argument 1 is invalid
    31 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs)>
      |                                                                                                          ^
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt.hpp:54:88: note: in expansion of macro ‘ONNX_NAMESPACE’
    54 |     virtual void registerLayer(nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node) = 0;
      |                                                                                        ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt.hpp:54:114: error: expected ‘,’ or ‘...’ before ‘const’
    54 |     virtual void registerLayer(nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node) = 0;
      |                                                                                                                  ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt.hpp:57:59: note: in expansion of macro ‘ONNX_NAMESPACE’
    57 |     virtual void registerLayer(nvinfer1::ILayer* layer, ::ONNX_NAMESPACE::NodeProto const& node) = 0;
      |                                                           ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt.hpp:57:85: error: expected ‘,’ or ‘...’ before ‘const’
    57 |     virtual void registerLayer(nvinfer1::ILayer* layer, ::ONNX_NAMESPACE::NodeProto const& node) = 0;
      |                                                                                     ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt.hpp:79:11: note: in expansion of macro ‘ONNX_NAMESPACE’
    79 |         ::ONNX_NAMESPACE::NodeProto const& node, char const* pluginName, char const* pluginLib)
      |           ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt.hpp:79:37: error: expected ‘,’ or ‘...’ before ‘const’
    79 |         ::ONNX_NAMESPACE::NodeProto const& node, char const* pluginName, char const* pluginLib)
      |                                     ^~~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/trt_utils.hpp:150:10: note: in expansion of macro ‘ONNX_NAMESPACE’
    150 | inline ::ONNX_NAMESPACE::TensorProto_DataType trtDataTypeToONNX(nvinfer1::DataType dt)
      |          ^~~~~~~~~~~~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:134:66: note: in expansion of macro ‘ONNX_NAMESPACE’
    134 | NodeImportResult activationHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                  ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:134:91: error: expected unqualified-id before ‘&’ token
    134 | NodeImportResult activationHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                           ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:134:91: error: expected ‘)’ before ‘&’ token
    134 | NodeImportResult activationHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                  ~                                                        ^
      |                                                                                           )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:134:93: error: expected initializer before ‘node’
    134 | NodeImportResult activationHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                             ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:141:65: note: in expansion of macro ‘ONNX_NAMESPACE’
    141 | NodeImportResult argMinMaxHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                 ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:141:90: error: expected unqualified-id before ‘&’ token
    141 | NodeImportResult argMinMaxHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                          ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:141:90: error: expected ‘)’ before ‘&’ token
    141 | NodeImportResult argMinMaxHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                 ~                                                        ^
      |                                                                                          )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:141:92: error: expected initializer before ‘node’
    141 | NodeImportResult argMinMaxHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                            ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:171:67: note: in expansion of macro ‘ONNX_NAMESPACE’
    171 | nvinfer1::ITensor* constantOfShape(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                   ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:171:92: error: expected unqualified-id before ‘&’ token
    171 | nvinfer1::ITensor* constantOfShape(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                            ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:171:92: error: expected ‘)’ before ‘&’ token
    171 | nvinfer1::ITensor* constantOfShape(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                   ~                                                        ^
      |                                                                                            )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:171:94: error: expected initializer before ‘node’
    171 | nvinfer1::ITensor* constantOfShape(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                              ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:198:13: note: in expansion of macro ‘ONNX_NAMESPACE’
    198 |     const ::ONNX_NAMESPACE::TensorProto& onnxTensor, onnx2trt::ShapedWeights* weights, IImporterContext* ctx);
      |             ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:198:40: error: expected unqualified-id before ‘&’ token
    198 |     const ::ONNX_NAMESPACE::TensorProto& onnxTensor, onnx2trt::ShapedWeights* weights, IImporterContext* ctx);
      |                                        ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:198:40: error: expected ‘)’ before ‘&’ token
    198 |     const ::ONNX_NAMESPACE::TensorProto& onnxTensor, onnx2trt::ShapedWeights* weights, IImporterContext* ctx);
      |                                        ^
      |                                        )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:197:24: note: to match this ‘(’
    197 | bool convertOnnxWeights(
      |                        ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:198:42: error: expected initializer before ‘onnxTensor’
    198 |     const ::ONNX_NAMESPACE::TensorProto& onnxTensor, onnx2trt::ShapedWeights* weights, IImporterContext* ctx);
      |                                          ^~~~~~~~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:202:36: note: in expansion of macro ‘ONNX_NAMESPACE’
    202 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs);
      |                                    ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:202:61: error: expected unqualified-id before ‘&’ token
    202 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs);
      |                                                             ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:202:61: error: expected ‘)’ before ‘&’ token
    202 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs);
      |                                                             ^
      |                                                             )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:201:32: note: to match this ‘(’
    201 | NodeImportResult convMultiInput(
      |                                ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:202:63: error: expected initializer before ‘node’
    202 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs);
      |                                                               ^~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:220:61: note: in expansion of macro ‘ONNX_NAMESPACE’
    220 | NodeImportResult elementwiseHelper(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node,
      |                                                             ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:220:87: error: expected ‘,’ or ‘...’ before ‘const’
    220 | NodeImportResult elementwiseHelper(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node,
      |                                                                                       ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:224:59: note: in expansion of macro ‘ONNX_NAMESPACE’
    224 | nvinfer1::ITensor* flattenTensor(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ITensor& tensor, int axis = 0, bool regLayer = false);
      |                                                           ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:224:85: error: expected ‘,’ or ‘...’ before ‘const’
    224 | nvinfer1::ITensor* flattenTensor(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ITensor& tensor, int axis = 0, bool regLayer = false);
      |                                                                                     ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:253:47: note: in expansion of macro ‘ONNX_NAMESPACE’
    253 | void getKernelParams(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& onnx_node, nvinfer1::Dims* kernel_size,
      |                                               ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:253:73: error: expected ‘,’ or ‘...’ before ‘const’
    253 | void getKernelParams(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& onnx_node, nvinfer1::Dims* kernel_size,
      |                                                                         ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:265:65: note: in expansion of macro ‘ONNX_NAMESPACE’
    265 | nvinfer1::ITensor* globalPoolingHelper(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ITensor& tensor, nvinfer1::ReduceOperation op);
      |                                                                 ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:265:91: error: expected ‘,’ or ‘...’ before ‘const’
    265 | nvinfer1::ITensor* globalPoolingHelper(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ITensor& tensor, nvinfer1::ReduceOperation op);
      |                                                                                           ^~~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:268:70: note: in expansion of macro ‘ONNX_NAMESPACE’
    268 | nvinfer1::ITensor* greaterLessOrEqual(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* inputA, nvinfer1::ITensor* inputB,
      |                                                                      ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:268:95: error: expected unqualified-id before ‘&’ token
    268 | nvinfer1::ITensor* greaterLessOrEqual(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* inputA, nvinfer1::ITensor* inputB,
      |                                                                                               ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:268:95: error: expected ‘)’ before ‘&’ token
    268 | nvinfer1::ITensor* greaterLessOrEqual(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* inputA, nvinfer1::ITensor* inputB,
      |                                      ~                                                        ^
      |                                                                                               )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:268:97: error: expected initializer before ‘node’
    268 | nvinfer1::ITensor* greaterLessOrEqual(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* inputA, nvinfer1::ITensor* inputB,
      |                                                                                                 ^~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:276:30: note: in expansion of macro ‘ONNX_NAMESPACE’
    276 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs);
      |                              ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:276:56: error: expected ‘,’ or ‘...’ before ‘const’
    276 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs);
      |                                                        ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:297:30: note: in expansion of macro ‘ONNX_NAMESPACE’
    297 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs);
      |                              ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:297:56: error: expected ‘,’ or ‘...’ before ‘const’
    297 |     IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, std::vector<TensorOrWeights>& inputs);
      |                                                        ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:308:57: note: in expansion of macro ‘ONNX_NAMESPACE’
    308 | NodeImportResult poolingHelper(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node,
      |                                                         ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:308:83: error: expected ‘,’ or ‘...’ before ‘const’
    308 | NodeImportResult poolingHelper(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node,
      |                                                                                   ^~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:312:56: note: in expansion of macro ‘ONNX_NAMESPACE’
    312 | NodeImportResult reduceTensor(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, TensorOrWeights input,
      |                                                        ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:312:82: error: expected ‘,’ or ‘...’ before ‘const’
    312 | NodeImportResult reduceTensor(IImporterContext* ctx, ::ONNX_NAMESPACE::NodeProto const& node, TensorOrWeights input,
      |                                                                                  ^~~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:319:61: note: in expansion of macro ‘ONNX_NAMESPACE’
    319 | NodeImportResult scaleHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor_,
      |                                                             ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:319:86: error: expected unqualified-id before ‘&’ token
    319 | NodeImportResult scaleHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor_,
      |                                                                                      ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:319:86: error: expected ‘)’ before ‘&’ token
    319 | NodeImportResult scaleHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor_,
      |                             ~                                                        ^
      |                                                                                      )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:319:88: error: expected initializer before ‘node’
    319 | NodeImportResult scaleHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor_,
      |                                                                                        ^~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:325:32: note: in expansion of macro ‘ONNX_NAMESPACE’
    325 |     nvinfer1::Dims* trtAttr, ::ONNX_NAMESPACE::AttributeProto const* onnxAttr, int nbSpatialDims, int defaultVal);
      |                                ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:325:63: error: expected ‘,’ or ‘...’ before ‘const’
    325 |     nvinfer1::Dims* trtAttr, ::ONNX_NAMESPACE::AttributeProto const* onnxAttr, int nbSpatialDims, int defaultVal);
      |                                                               ^~~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:329:36: note: in expansion of macro ‘ONNX_NAMESPACE’
    329 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* data, const int axis);
      |                                    ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:329:61: error: expected unqualified-id before ‘&’ token
    329 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* data, const int axis);
      |                                                             ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:329:61: error: expected ‘)’ before ‘&’ token
    329 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* data, const int axis);
      |                                                             ^
      |                                                             )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:328:35: note: to match this ‘(’
    328 | nvinfer1::ITensor* sliceAcrossAxis(
      |                                   ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:329:63: error: expected initializer before ‘node’
    329 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor* data, const int axis);
      |                                                               ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:332:65: note: in expansion of macro ‘ONNX_NAMESPACE’
    332 | nvinfer1::ITensor* squeezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor, const std::vector<int>& axes, bool regLayer = false);
      |                                                                 ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:332:90: error: expected unqualified-id before ‘&’ token
    332 | nvinfer1::ITensor* squeezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor, const std::vector<int>& axes, bool regLayer = false);
      |                                                                                          ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:332:90: error: expected ‘)’ before ‘&’ token
    332 | nvinfer1::ITensor* squeezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor, const std::vector<int>& axes, bool regLayer = false);
      |                                 ~                                                        ^
      |                                                                                          )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:332:92: error: expected initializer before ‘node’
    332 | nvinfer1::ITensor* squeezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& tensor, const std::vector<int>& axes, bool regLayer = false);
      |                                                                                            ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:335:67: note: in expansion of macro ‘ONNX_NAMESPACE’
    335 | nvinfer1::ITensor* transposeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                   ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:335:92: error: expected unqualified-id before ‘&’ token
    335 | nvinfer1::ITensor* transposeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                            ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:335:92: error: expected ‘)’ before ‘&’ token
    335 | nvinfer1::ITensor* transposeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                   ~                                                        ^
      |                                                                                            )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:335:94: error: expected initializer before ‘node’
    335 | nvinfer1::ITensor* transposeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                              ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:339:61: note: in expansion of macro ‘ONNX_NAMESPACE’
    339 | NodeImportResult unaryHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, TensorOrWeights& input,
      |                                                             ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:339:86: error: expected unqualified-id before ‘&’ token
    339 | NodeImportResult unaryHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, TensorOrWeights& input,
      |                                                                                      ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:339:86: error: expected ‘)’ before ‘&’ token
    339 | NodeImportResult unaryHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, TensorOrWeights& input,
      |                             ~                                                        ^
      |                                                                                      )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:339:88: error: expected initializer before ‘node’
    339 | NodeImportResult unaryHelper(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, TensorOrWeights& input,
      |                                                                                        ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:343:67: note: in expansion of macro ‘ONNX_NAMESPACE’
    343 | nvinfer1::ITensor* unsqueezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                   ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:343:92: error: expected unqualified-id before ‘&’ token
    343 | nvinfer1::ITensor* unsqueezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                            ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:343:92: error: expected ‘)’ before ‘&’ token
    343 | nvinfer1::ITensor* unsqueezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                   ~                                                        ^
      |                                                                                            )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:343:94: error: expected initializer before ‘node’
    343 | nvinfer1::ITensor* unsqueezeTensor(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node,
      |                                                                                              ^~~~
    In file included from ....../onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp: In function ‘onnx2trt::Status onnx2trt::weightsToVector(onnx2trt::TensorOrWeights, std::vector<ScalarType>*)’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/Status.hpp:32:15: note: in definition of macro ‘ASSERT’
    32 |         if (!(condition))                                                                                              \
      |               ^~~~~~~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp:355:41: note: in expansion of macro ‘ONNX_NAMESPACE’
    355 |     ASSERT((weights.weights().type == ::ONNX_NAMESPACE::TensorProto::INT32)
      |                                         ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/Status.hpp:32:15: note: in definition of macro ‘ASSERT’
    32 |         if (!(condition))                                                                                              \
      |               ^~~~~~~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp:356:45: note: in expansion of macro ‘ONNX_NAMESPACE’
    356 |             || (weights.weights().type == ::ONNX_NAMESPACE::TensorProto::INT64)
      |                                             ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/Status.hpp:32:15: note: in definition of macro ‘ASSERT’
    32 |         if (!(condition))                                                                                              \
      |               ^~~~~~~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp:357:45: note: in expansion of macro ‘ONNX_NAMESPACE’
    357 |             || (weights.weights().type == ::ONNX_NAMESPACE::TensorProto::BOOL),
      |                                             ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:360:37: note: in expansion of macro ‘ONNX_NAMESPACE’
    360 |     if (weights.weights().type == ::ONNX_NAMESPACE::TensorProto::INT64)
      |                                     ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:365:42: note: in expansion of macro ‘ONNX_NAMESPACE’
    365 |     else if (weights.weights().type == ::ONNX_NAMESPACE::TensorProto::INT32)
      |                                          ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:370:42: note: in expansion of macro ‘ONNX_NAMESPACE’
    370 |     else if (weights.weights().type == ::ONNX_NAMESPACE::TensorProto::BOOL)
      |                                          ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp: In function ‘onnx2trt::ShapedWeights::DataType onnx2trt::getShapeWeightsDataType()’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:381:56: note: in expansion of macro ‘ONNX_NAMESPACE’
    381 |     static const std::unordered_map<std::type_index, ::ONNX_NAMESPACE::TensorProto::DataType> tMap(
      |                                                        ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:381:93: error: template argument 2 is invalid
    381 |     static const std::unordered_map<std::type_index, ::ONNX_NAMESPACE::TensorProto::DataType> tMap(
      |                                                                                             ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:381:93: error: template argument 5 is invalid
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:382:44: note: in expansion of macro ‘ONNX_NAMESPACE’
    382 |         {{std::type_index(typeid(bool)), ::ONNX_NAMESPACE::TensorProto::BOOL},
      |                                            ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:383:49: note: in expansion of macro ‘ONNX_NAMESPACE’
    383 |             {std::type_index(typeid(int8_t)), ::ONNX_NAMESPACE::TensorProto::INT8},
      |                                                 ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:384:50: note: in expansion of macro ‘ONNX_NAMESPACE’
    384 |             {std::type_index(typeid(uint8_t)), ::ONNX_NAMESPACE::TensorProto::UINT8},
      |                                                  ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:385:50: note: in expansion of macro ‘ONNX_NAMESPACE’
    385 |             {std::type_index(typeid(int16_t)), ::ONNX_NAMESPACE::TensorProto::INT16},
      |                                                  ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:386:51: note: in expansion of macro ‘ONNX_NAMESPACE’
    386 |             {std::type_index(typeid(uint16_t)), ::ONNX_NAMESPACE::TensorProto::UINT16},
      |                                                   ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:387:50: note: in expansion of macro ‘ONNX_NAMESPACE’
    387 |             {std::type_index(typeid(int32_t)), ::ONNX_NAMESPACE::TensorProto::INT32},
      |                                                  ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:388:51: note: in expansion of macro ‘ONNX_NAMESPACE’
    388 |             {std::type_index(typeid(uint32_t)), ::ONNX_NAMESPACE::TensorProto::UINT32},
      |                                                   ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:389:50: note: in expansion of macro ‘ONNX_NAMESPACE’
    389 |             {std::type_index(typeid(int64_t)), ::ONNX_NAMESPACE::TensorProto::INT64},
      |                                                  ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:390:51: note: in expansion of macro ‘ONNX_NAMESPACE’
    390 |             {std::type_index(typeid(uint64_t)), ::ONNX_NAMESPACE::TensorProto::UINT64},
      |                                                   ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:391:48: note: in expansion of macro ‘ONNX_NAMESPACE’
    391 |             {std::type_index(typeid(float)), ::ONNX_NAMESPACE::TensorProto::FLOAT},
      |                                                ^~~~~~~~~~~~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:392:49: note: in expansion of macro ‘ONNX_NAMESPACE’
    392 |             {std::type_index(typeid(double)), ::ONNX_NAMESPACE::TensorProto::DOUBLE}});
      |                                                 ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:394:14: error: request for member ‘find’ in ‘tMap’, which is of non-class type ‘const int’
    394 |     if (tMap.find(std::type_index(typeid(T))) != tMap.end())
      |              ^~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp:394:55: error: request for member ‘end’ in ‘tMap’, which is of non-class type ‘const int’
    394 |     if (tMap.find(std::type_index(typeid(T))) != tMap.end())
      |                                                       ^~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp:396:21: error: request for member ‘at’ in ‘tMap’, which is of non-class type ‘const int’
    396 |         return tMap.at(std::type_index(typeid(T)));
      |                     ^~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:398:14: note: in expansion of macro ‘ONNX_NAMESPACE’
    398 |     return ::ONNX_NAMESPACE::TensorProto::UNDEFINED;
      |              ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp: In function ‘onnx2trt::Status onnx2trt::vectorToWeights(std::vector<ScalarType>&, onnx2trt::TensorOrWeights*)’:
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/Status.hpp:32:15: note: in definition of macro ‘ASSERT’
    32 |         if (!(condition))                                                                                              \
      |               ^~~~~~~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp:407:23: note: in expansion of macro ‘ONNX_NAMESPACE’
    407 |     ASSERT(dtype != ::ONNX_NAMESPACE::TensorProto::UNDEFINED && "Unsupported datatype", ErrorCode::kINVALID_VALUE);
      |                       ^~~~~~~~~~~~~~
    ....../onnx-tensorrt/onnx2trt_utils.hpp: At global scope:
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:413:39: note: in expansion of macro ‘ONNX_NAMESPACE’
    413 | const std::string getNodeName(const ::ONNX_NAMESPACE::NodeProto& node);
      |                                       ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:413:64: error: expected unqualified-id before ‘&’ token
    413 | const std::string getNodeName(const ::ONNX_NAMESPACE::NodeProto& node);
      |                                                                ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:413:64: error: expected ‘)’ before ‘&’ token
    413 | const std::string getNodeName(const ::ONNX_NAMESPACE::NodeProto& node);
      |                              ~                                 ^
      |                                                                )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:413:66: error: expected initializer before ‘node’
    413 | const std::string getNodeName(const ::ONNX_NAMESPACE::NodeProto& node);
      |                                                                  ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:428:62: note: in expansion of macro ‘ONNX_NAMESPACE’
    428 | nvinfer1::ITensor* addSoftmax(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& input);
      |                                                              ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:428:87: error: expected unqualified-id before ‘&’ token
    428 | nvinfer1::ITensor* addSoftmax(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& input);
      |                                                                                       ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:428:87: error: expected ‘)’ before ‘&’ token
    428 | nvinfer1::ITensor* addSoftmax(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& input);
      |                              ~                                                        ^
      |                                                                                       )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:428:89: error: expected initializer before ‘node’
    428 | nvinfer1::ITensor* addSoftmax(IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, nvinfer1::ITensor& input);
      |                                                                                         ^~~~
    <command-line>: error: ‘onnx2trt_onnx’ in namespace ‘::’ does not name a type; did you mean ‘onnx2trt’?
    ....../onnx-tensorrt/onnx2trt_utils.hpp:432:36: note: in expansion of macro ‘ONNX_NAMESPACE’
    432 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs, nvinfer1::ScatterMode mode, int32_t axis = 0);
      |                                    ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:432:61: error: expected unqualified-id before ‘&’ token
    432 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs, nvinfer1::ScatterMode mode, int32_t axis = 0);
      |                                                             ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:432:61: error: expected ‘)’ before ‘&’ token
    432 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs, nvinfer1::ScatterMode mode, int32_t axis = 0);
      |                                                             ^
      |                                                             )
    ....../onnx-tensorrt/onnx2trt_utils.hpp:431:33: note: to match this ‘(’
    431 | NodeImportResult addScatterLayer(
      |                                 ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:432:63: error: expected initializer before ‘node’
    432 |     IImporterContext* ctx, const ::ONNX_NAMESPACE::NodeProto& node, std::vector<TensorOrWeights>& inputs, nvinfer1::ScatterMode mode, int32_t axis = 0);
      |                                                               ^~~~
    <command-line>: error: ‘::onnx2trt_onnx’ has not been declared
    ....../onnx-tensorrt/onnx2trt_utils.hpp:463:26: note: in expansion of macro ‘ONNX_NAMESPACE’
    463 | Status processMetadata(::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ILayer* layer);
      |                          ^~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:8,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt_utils.hpp:463:81: error: expected primary-expression before ‘*’ token
    463 | Status processMetadata(::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ILayer* layer);
      |                                                                                 ^
    ....../onnx-tensorrt/onnx2trt_utils.hpp:463:83: error: ‘layer’ was not declared in this scope
    463 | Status processMetadata(::ONNX_NAMESPACE::NodeProto const& node, nvinfer1::ILayer* layer);
      |                                                                                   ^~~~~
    In file included from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/ImporterContext.hpp:173:78: error: ‘onnx2trt_onnx::NodeProto’ has not been declared
    173 |     void registerLayer(nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node) override;
      |                                                                              ^~
    ....../onnx-tensorrt/ImporterContext.hpp:174:49: error: ‘onnx2trt_onnx::NodeProto’ has not been declared
    174 |     void registerLayer(nvinfer1::ILayer* layer, ::ONNX_NAMESPACE::NodeProto const& node) override;
      |                                                 ^~
    ....../onnx-tensorrt/ImporterContext.hpp:289:9: error: ‘onnx2trt_onnx::NodeProto’ has not been declared
    289 |         ::ONNX_NAMESPACE::NodeProto const& node, char const* pluginName, char const* pluginLib) final;
      |         ^~
    ....../onnx-tensorrt/ImporterContext.hpp:173:10: error: ‘void onnx2trt::ImporterContext::registerLayer(nvinfer1::ILayer*, const string&, const int*)’ marked ‘override’, but does not override
    173 |     void registerLayer(nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node) override;
      |          ^~~~~~~~~~~~~
    ....../onnx-tensorrt/ImporterContext.hpp:174:10: error: ‘void onnx2trt::ImporterContext::registerLayer(nvinfer1::ILayer*, const int&)’ marked ‘override’, but does not override
    174 |     void registerLayer(nvinfer1::ILayer* layer, ::ONNX_NAMESPACE::NodeProto const& node) override;
      |          ^~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/ModelImporter.hpp:16:42: error: ‘onnx2trt_onnx::GraphProto’ has not been declared
    16 | Status parseGraph(IImporterContext* ctx, ::ONNX_NAMESPACE::GraphProto const& graph, bool deserializingINetwork = false,
      |                                          ^~
    ....../onnx-tensorrt/ModelImporter.hpp:23:32: error: ‘onnx2trt_onnx::ModelProto’ has not been declared
    23 |     virtual Status importModel(::ONNX_NAMESPACE::ModelProto const& model);
      |                                ^~
    ....../onnx-tensorrt/ModelImporter.hpp:30:33: error: ‘ModelProto’ is not a member of ‘onnx2trt_onnx’; did you mean ‘onnx::ModelProto’?
    30 |     std::list<::ONNX_NAMESPACE::ModelProto> mONNXModels; // Needed for ownership of weights
      |                                 ^~~~~~~~~~
    In file included from /usr/local/include/onnx/onnx_pb.h:53,
                 from ....../onnx-tensorrt/ShapedWeights.hpp:8,
                 from ....../onnx-tensorrt/onnx2trt.hpp:8,
                 from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    /usr/local/include/onnx/onnx.pb.h:1612:16: note: ‘onnx::ModelProto’ declared here
    1612 | class ONNX_API ModelProto final :
      |                ^~~~~~~~~~
    In file included from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/ModelImporter.hpp:30:43: error: template argument 1 is invalid
    30 |     std::list<::ONNX_NAMESPACE::ModelProto> mONNXModels; // Needed for ownership of weights
      |                                           ^
    ....../onnx-tensorrt/ModelImporter.hpp:30:43: error: template argument 2 is invalid
    ....../onnx-tensorrt/ModelImporter.hpp:26:21: error: cannot declare field ‘onnx2trt::ModelImporter::mImporterCtx’ to be of abstract type ‘onnx2trt::ImporterContext’
    26 |     ImporterContext mImporterCtx;
      |                     ^~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/ImporterContext.hpp:71:7: note:   because the following virtual functions are pure within ‘onnx2trt::ImporterContext’:
    71 | class ImporterContext final : public IImporterContext
      |       ^~~~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt.hpp:54:18: note:     ‘virtual void onnx2trt::IImporterContext::registerLayer(nvinfer1::ILayer*, const string&, int)’
    54 |     virtual void registerLayer(nvinfer1::ILayer* layer, std::string const& basename, ::ONNX_NAMESPACE::NodeProto const* node) = 0;
      |                  ^~~~~~~~~~~~~
    In file included from ....../onnx-tensorrt/ImporterContext.hpp:7,
                 from ....../onnx-tensorrt/ModelImporter.hpp:7,
                 from ....../onnx-tensorrt/NvOnnxParser.cpp:6:
    ....../onnx-tensorrt/onnx2trt.hpp:57:18: note:     ‘virtual void onnx2trt::IImporterContext::registerLayer(nvinfer1::ILayer*, int)’
    57 |     virtual void registerLayer(nvinfer1::ILayer* layer, ::ONNX_NAMESPACE::NodeProto const& node) = 0;
      |                  ^~~~~~~~~~~~~
    ....../onnx-tensorrt/onnx2trt.hpp:78:18: note:     ‘virtual void onnx2trt::IImporterContext::addUsedVCPluginLibrary(int)’
    78 |     virtual void addUsedVCPluginLibrary(
      |                  ^~~~~~~~~~~~~~~~~~~~~~
    ^Cmake[2]: *** [CMakeFiles/nvonnxparser.dir/build.make:79: CMakeFiles/nvonnxparser.dir/NvOnnxParser.cpp.o] Interrupt
    make[1]: *** [CMakeFiles/Makefile2:88: CMakeFiles/nvonnxparser.dir/all] Interrupt
    make: *** [Makefile:159: all] Interrupt

➜ build git:(main) ✗



Can anybody help to take a look?
jiapei100 commented 1 year ago

Problem solved by modifying CMakeLists.txt

    # set(ONNX_NAMESPACE "onnx2trt_onnx")
    set(ONNX_NAMESPACE "onnx")