Caffe2's bug, with TensorRT?

My ENR:

➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
➜  ~ gcc --version
gcc (GCC) 10.3.1 20210627
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

➜  ~ python --version
Python 3.8.10

ERRORs:


pytorch/caffe2/contrib/tensorrt/trt_utils.h:16:8: error: looser exception specification on overriding virtual function ‘virtual void caffe2::tensorrt::TrtLogger::log(nvinfer1::ILogger::Severity, const char*)’
   16 |   void log(Severity severity, const char* msg) override {
      |        ^~~
In file included from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:11:
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h:16:8: error: looser exception specification on overriding virtual function ‘virtual void caffe2::tensorrt::TrtLogger::log(nvinfer1::ILogger::Severity, const char*)’
   16 |   void log(Severity severity, const char* msg) override {
      |        ^~~
In file included from /usr/local/cuda/include/NvInferLegacyDims.h:53,
                 from /usr/local/cuda/include/NvInfer.h:53,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:6:
/usr/local/cuda/include/NvInferRuntimeCommon.h:1222:18: note: overridden function is ‘virtual void nvinfer1::ILogger::log(nvinfer1::ILogger::Severity, const AsciiChar*) noexcept’
 1222 |     virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
      |                  ^~~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/caffe2/core/common_cudnn.h: In destructor ‘caffe2::cudnnTensorDescWrapper::~cudnnTensorDescWrapper()’:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: error: ‘Status’ was not declared in this scope
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/common_cudnn.h:216:5: note: in expansion of macro ‘CUDNN_CHECK’
  216 |     CUDNN_CHECK(cudnnDestroyTensorDescriptor(desc_));
      |     ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: suggested alternatives:
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/common_cudnn.h:216:5: note: in expansion of macro ‘CUDNN_CHECK’
  216 |     CUDNN_CHECK(cudnnDestroyTensorDescriptor(desc_));
      |     ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:79:7: note:   ‘onnx2trt::Status’
   79 | class Status : public nvonnxparser::IParserError
      |       ^~~~~~
In file included from ....../pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:142,
                 from ....../pytorch/build/caffe2/proto/caffe2.pb.h:23,
                 from ....../pytorch/caffe2/proto/caffe2_pb.h:4,
                 from ....../pytorch/caffe2/core/context_base.h:18,
                 from ....../pytorch/caffe2/core/context.h:11,
                 from ....../pytorch/caffe2/core/storage.h:14,
                 from ....../pytorch/caffe2/core/tensor.h:5,
                 from ....../pytorch/caffe2/core/blob.h:14,
                 from ....../pytorch/caffe2/core/operator.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.h:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:1:
....../pytorch/third_party/protobuf/src/google/protobuf/stubs/logging.h:68:7: note:   ‘google::protobuf::util::Status’
   68 | class Status;
      |       ^~~~~~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: error: request for member ‘is_success’ in ‘status’, which is of non-class type ‘cudnnStatus_t’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: note: in definition of macro ‘CHECK’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/caffe2/core/common_cudnn.h:216:5: note: in expansion of macro ‘CUDNN_CHECK’
  216 |     CUDNN_CHECK(cudnnDestroyTensorDescriptor(desc_));
      |     ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: error: returning a value from a destructor
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: note: in definition of macro ‘CHECK’
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/caffe2/core/common_cudnn.h:216:5: note: in expansion of macro ‘CUDNN_CHECK’
  216 |     CUDNN_CHECK(cudnnDestroyTensorDescriptor(desc_));
      |     ^~~~~~~~~~~
In file included from ....../pytorch/caffe2/core/context_gpu.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:12:
....../pytorch/caffe2/core/common_cudnn.h:86:9: error: expected ‘;’ before ‘<<’ token
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: note: in definition of macro ‘CUDNN_CHECK’
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: error: expected primary-expression before ‘<<’ token
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: note: in definition of macro ‘CUDNN_CHECK’
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/caffe2/core/common_cudnn.h: In destructor ‘caffe2::cudnnFilterDescWrapper::~cudnnFilterDescWrapper()’:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: error: ‘Status’ was not declared in this scope
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/common_cudnn.h:270:5: note: in expansion of macro ‘CUDNN_CHECK’
  270 |     CUDNN_CHECK(cudnnDestroyFilterDescriptor(desc_));
      |     ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: suggested alternatives:
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/common_cudnn.h:270:5: note: in expansion of macro ‘CUDNN_CHECK’
  270 |     CUDNN_CHECK(cudnnDestroyFilterDescriptor(desc_));
      |     ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:79:7: note:   ‘onnx2trt::Status’
   79 | class Status : public nvonnxparser::IParserError
      |       ^~~~~~
In file included from ....../pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:142,
                 from ....../pytorch/build/caffe2/proto/caffe2.pb.h:23,
                 from ....../pytorch/caffe2/proto/caffe2_pb.h:4,
                 from ....../pytorch/caffe2/core/context_base.h:18,
                 from ....../pytorch/caffe2/core/context.h:11,
                 from ....../pytorch/caffe2/core/storage.h:14,
                 from ....../pytorch/caffe2/core/tensor.h:5,
                 from ....../pytorch/caffe2/core/blob.h:14,
                 from ....../pytorch/caffe2/core/operator.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.h:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:1:
....../pytorch/third_party/protobuf/src/google/protobuf/stubs/logging.h:68:7: note:   ‘google::protobuf::util::Status’
   68 | class Status;
      |       ^~~~~~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: error: request for member ‘is_success’ in ‘status’, which is of non-class type ‘cudnnStatus_t’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: note: in definition of macro ‘CHECK’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/caffe2/core/common_cudnn.h:270:5: note: in expansion of macro ‘CUDNN_CHECK’
  270 |     CUDNN_CHECK(cudnnDestroyFilterDescriptor(desc_));
      |     ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: error: returning a value from a destructor
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: note: in definition of macro ‘CHECK’
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/caffe2/core/common_cudnn.h:270:5: note: in expansion of macro ‘CUDNN_CHECK’
  270 |     CUDNN_CHECK(cudnnDestroyFilterDescriptor(desc_));
      |     ^~~~~~~~~~~
In file included from ....../pytorch/caffe2/core/context_gpu.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:12:
....../pytorch/caffe2/core/common_cudnn.h:86:9: error: expected ‘;’ before ‘<<’ token
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: note: in definition of macro ‘CUDNN_CHECK’
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: error: expected primary-expression before ‘<<’ token
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: note: in definition of macro ‘CUDNN_CHECK’
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/caffe2/core/context_gpu.h: In destructor ‘caffe2::ThreadLocalCUDAObjects::~ThreadLocalCUDAObjects()’:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: error: ‘Status’ was not declared in this scope
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/context_gpu.h:145:9: note: in expansion of macro ‘CUBLAS_CHECK’
  145 |         CUBLAS_CHECK(cublasDestroy(element.second));
      |         ^~~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: suggested alternatives:
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/context_gpu.h:145:9: note: in expansion of macro ‘CUBLAS_CHECK’
  145 |         CUBLAS_CHECK(cublasDestroy(element.second));
      |         ^~~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:79:7: note:   ‘onnx2trt::Status’
   79 | class Status : public nvonnxparser::IParserError
      |       ^~~~~~
In file included from ....../pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:142,
                 from ....../pytorch/build/caffe2/proto/caffe2.pb.h:23,
                 from ....../pytorch/caffe2/proto/caffe2_pb.h:4,
                 from ....../pytorch/caffe2/core/context_base.h:18,
                 from ....../pytorch/caffe2/core/context.h:11,
                 from ....../pytorch/caffe2/core/storage.h:14,
                 from ....../pytorch/caffe2/core/tensor.h:5,
                 from ....../pytorch/caffe2/core/blob.h:14,
                 from ....../pytorch/caffe2/core/operator.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.h:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:1:
....../pytorch/third_party/protobuf/src/google/protobuf/stubs/logging.h:68:7: note:   ‘google::protobuf::util::Status’
   68 | class Status;
      |       ^~~~~~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: error: request for member ‘is_success’ in ‘status’, which is of non-class type ‘cublasStatus_t’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: note: in definition of macro ‘CHECK’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/caffe2/core/context_gpu.h:145:9: note: in expansion of macro ‘CUBLAS_CHECK’
  145 |         CUBLAS_CHECK(cublasDestroy(element.second));
      |         ^~~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: error: returning a value from a destructor
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: note: in definition of macro ‘CHECK’
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/caffe2/core/context_gpu.h:145:9: note: in expansion of macro ‘CUBLAS_CHECK’
  145 |         CUBLAS_CHECK(cublasDestroy(element.second));
      |         ^~~~~~~~~~~~
In file included from ....../pytorch/caffe2/core/context_gpu.h:8,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:12:
....../pytorch/caffe2/core/common_gpu.h:233:9: error: expected ‘;’ before ‘<<’ token
  233 |         << ::caffe2::cublasGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_gpu.h:233:9: note: in definition of macro ‘CUBLAS_CHECK’
  233 |         << ::caffe2::cublasGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_gpu.h:233:9: error: expected primary-expression before ‘<<’ token
  233 |         << ::caffe2::cublasGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_gpu.h:233:9: note: in definition of macro ‘CUBLAS_CHECK’
  233 |         << ::caffe2::cublasGetErrorString(status); \
      |         ^~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: error: ‘Status’ was not declared in this scope
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/context_gpu.h:151:9: note: in expansion of macro ‘CUDNN_CHECK’
  151 |         CUDNN_CHECK(cudnnDestroy(element.second));
      |         ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: suggested alternatives:
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:67:9: note: in definition of macro ‘CHECK’
   67 |         Status status = call;                                                                                          \
      |         ^~~~~~
....../pytorch/caffe2/core/context_gpu.h:151:9: note: in expansion of macro ‘CUDNN_CHECK’
  151 |         CUDNN_CHECK(cudnnDestroy(element.second));
      |         ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:79:7: note:   ‘onnx2trt::Status’
   79 | class Status : public nvonnxparser::IParserError
      |       ^~~~~~
In file included from ....../pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:142,
                 from ....../pytorch/build/caffe2/proto/caffe2.pb.h:23,
                 from ....../pytorch/caffe2/proto/caffe2_pb.h:4,
                 from ....../pytorch/caffe2/core/context_base.h:18,
                 from ....../pytorch/caffe2/core/context.h:11,
                 from ....../pytorch/caffe2/core/storage.h:14,
                 from ....../pytorch/caffe2/core/tensor.h:5,
                 from ....../pytorch/caffe2/core/blob.h:14,
                 from ....../pytorch/caffe2/core/operator.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.h:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:1:
....../pytorch/third_party/protobuf/src/google/protobuf/stubs/logging.h:68:7: note:   ‘google::protobuf::util::Status’
   68 | class Status;
      |       ^~~~~~
In file included from ....../pytorch/cmake/../third_party/onnx-tensorrt/onnx2trt.hpp:9,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:7:
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: error: request for member ‘is_success’ in ‘status’, which is of non-class type ‘cudnnStatus_t’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:68:21: note: in definition of macro ‘CHECK’
   68 |         if (!status.is_success())                                                                                      \
      |                     ^~~~~~~~~~
....../pytorch/caffe2/core/context_gpu.h:151:9: note: in expansion of macro ‘CUDNN_CHECK’
  151 |         CUDNN_CHECK(cudnnDestroy(element.second));
      |         ^~~~~~~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: error: returning a value from a destructor
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/cmake/../third_party/onnx-tensorrt/Status.hpp:70:20: note: in definition of macro ‘CHECK’
   70 |             return status;                                                                                             \
      |                    ^~~~~~
....../pytorch/caffe2/core/context_gpu.h:151:9: note: in expansion of macro ‘CUDNN_CHECK’
  151 |         CUDNN_CHECK(cudnnDestroy(element.second));
      |         ^~~~~~~~~~~
In file included from ....../pytorch/caffe2/core/context_gpu.h:20,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:12:
....../pytorch/caffe2/core/common_cudnn.h:86:9: error: expected ‘;’ before ‘<<’ token
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: note: in definition of macro ‘CUDNN_CHECK’
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: error: expected primary-expression before ‘<<’ token
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/core/common_cudnn.h:86:9: note: in definition of macro ‘CUDNN_CHECK’
   86 |         << ::caffe2::internal::cudnnGetErrorString(status); \
      |         ^~
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc: In member function ‘void caffe2::TensorRTTransformer::Transform(caffe2::Workspace*, caffe2::NetDef*, const std::unordered_map<std::__cxx11::basic_string<char>, caffe2::TensorShape>&)’:
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:487:55: error: ‘using element_type = class nvinfer1::IBuilder’ {aka ‘class nvinfer1::IBuilder’} has no member named ‘createNetwork’; did you mean ‘createNetworkV2’?
  487 |   auto trt_network = tensorrt::TrtObject(trt_builder->createNetwork());
      |                                                       ^~~~~~~~~~~~~
      |                                                       createNetworkV2
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc: In lambda function:
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:502:16: error: ‘importer’ is not captured
  502 |           if (!importer->supportsOperator(n.op_type().c_str())) {
      |                ^~~~~~~~
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:493:41: note: the lambda has no capture-default
  493 |       [&exporter, &shape_hints, importer](const caffe2::OperatorDef& op) {
      |                                         ^
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:488:8: note: ‘<typeprefixerror>importer’ declared here
  488 |   auto importer =
      |        ^~~~~~~~
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc: In member function ‘void caffe2::TensorRTTransformer::Transform(caffe2::Workspace*, caffe2::NetDef*, const std::unordered_map<std::__cxx11::basic_string<char>, caffe2::TensorShape>&)’:
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:522:3: error: expected ‘,’ or ‘;’ before ‘NetDef’
  522 |   NetDef net_opt = std::move(cutResult.net);
      |   ^~~~~~
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:525:3: error: ‘net_opt’ was not declared in this scope; did you mean ‘getopt’?
  525 |   net_opt.mutable_device_option()->CopyFrom(pred_net->device_option());
      |   ^~~~~~~
      |   getopt
In file included from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:11:
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h: In instantiation of ‘void caffe2::tensorrt::TrtDeleter::operator()(T*) const [with T = nvinfer1::IHostMemory]’:
/usr/local/include/c++/10.3.1/bits/shared_ptr_base.h:669:11:   required from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter, _Alloc) [with _Ptr = nvinfer1::IHostMemory*; _Deleter = caffe2::tensorrt::TrtDeleter; _Alloc = std::allocator<void>; <template-parameter-2-4> = void; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/local/include/c++/10.3.1/bits/shared_ptr_base.h:650:57:   required from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter) [with _Ptr = nvinfer1::IHostMemory*; _Deleter = caffe2::tensorrt::TrtDeleter; <template-parameter-2-3> = void; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/local/include/c++/10.3.1/bits/shared_ptr_base.h:1142:48:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Yp*, _Deleter) [with _Yp = nvinfer1::IHostMemory; _Deleter = caffe2::tensorrt::TrtDeleter; <template-parameter-2-3> = void; _Tp = nvinfer1::IHostMemory; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/local/include/c++/10.3.1/bits/shared_ptr.h:177:48:   required from ‘std::shared_ptr<_Tp>::shared_ptr(_Yp*, _Deleter) [with _Yp = nvinfer1::IHostMemory; _Deleter = caffe2::tensorrt::TrtDeleter; <template-parameter-2-3> = void; _Tp = nvinfer1::IHostMemory]’
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h:44:15:   required from ‘std::shared_ptr<_Tp> caffe2::tensorrt::TrtObject(T*) [with T = nvinfer1::IHostMemory]’
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:266:65:   required from here
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h:36:19: warning: ‘void nvinfer1::IHostMemory::destroy()’ is deprecated [-Wdeprecated-declarations]
   36 |       obj->destroy();
      |       ~~~~~~~~~~~~^~
In file included from /usr/local/cuda/include/NvInfer.h:54,
                 from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:6:
/usr/local/cuda/include/NvInferRuntime.h:199:25: note: declared here
  199 |     TRT_DEPRECATED void destroy() noexcept
      |                         ^~~~~~~
In file included from ....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:11:
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h: In instantiation of ‘void caffe2::tensorrt::TrtDeleter::operator()(T*) const [with T = nvinfer1::IBuilder]’:
/usr/local/include/c++/10.3.1/bits/shared_ptr_base.h:669:11:   required from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter, _Alloc) [with _Ptr = nvinfer1::IBuilder*; _Deleter = caffe2::tensorrt::TrtDeleter; _Alloc = std::allocator<void>; <template-parameter-2-4> = void; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/local/include/c++/10.3.1/bits/shared_ptr_base.h:650:57:   required from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter) [with _Ptr = nvinfer1::IBuilder*; _Deleter = caffe2::tensorrt::TrtDeleter; <template-parameter-2-3> = void; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/local/include/c++/10.3.1/bits/shared_ptr_base.h:1142:48:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Yp*, _Deleter) [with _Yp = nvinfer1::IBuilder; _Deleter = caffe2::tensorrt::TrtDeleter; <template-parameter-2-3> = void; _Tp = nvinfer1::IBuilder; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/local/include/c++/10.3.1/bits/shared_ptr.h:177:48:   required from ‘std::shared_ptr<_Tp>::shared_ptr(_Yp*, _Deleter) [with _Yp = nvinfer1::IBuilder; _Deleter = caffe2::tensorrt::TrtDeleter; <template-parameter-2-3> = void; _Tp = nvinfer1::IBuilder]’
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h:44:15:   required from ‘std::shared_ptr<_Tp> caffe2::tensorrt::TrtObject(T*) [with T = nvinfer1::IBuilder]’
....../pytorch/caffe2/contrib/tensorrt/tensorrt_tranformer.cc:486:78:   required from here
....../pytorch/caffe2/contrib/tensorrt/trt_utils.h:36:19: warning: ‘void nvinfer1::IBuilder::destroy()’ is deprecated [-Wdeprecated-declarations]
   36 |       obj->destroy();
      |       ~~~~~~~~~~~~^~

Can anybody give some help please?

Cheers

1 Like

Hello,

You have resolved this issue?

Thank you.