Go to the documentation of this file.
23 #ifndef NV_ONNX_PARSER_H
24 #define NV_ONNX_PARSER_H
36 #define NV_ONNX_PARSER_MAJOR 0
37 #define NV_ONNX_PARSER_MINOR 1
38 #define NV_ONNX_PARSER_PATCH 0
40 static const int NV_ONNX_PARSER_VERSION = ((NV_ONNX_PARSER_MAJOR * 10000) + (NV_ONNX_PARSER_MINOR * 100) + NV_ONNX_PARSER_PATCH);
56 class onnxTensorDescriptorV1;
66 inline int32_t EnumMax();
72 enum class ErrorCode : int
76 kMEM_ALLOC_FAILED = 2,
77 kMODEL_DESERIALIZE_FAILED = 3,
81 kUNSUPPORTED_GRAPH = 7,
86 inline int32_t EnumMax<ErrorCode>()
100 virtual ErrorCode
code()
const = 0;
103 virtual const char*
desc()
const = 0;
106 virtual const char*
file()
const = 0;
109 virtual int line()
const = 0;
112 virtual const char*
func()
const = 0;
115 virtual int node()
const = 0;
140 virtual bool parse(
void const* serialized_onnx_model,
141 size_t serialized_onnx_model_size)
153 virtual bool parseFromFile(
const char* onnxModelFile,
int verbosity) = 0;
163 virtual bool supportsModel(
void const* serialized_onnx_model,
164 size_t serialized_onnx_model_size,
180 void const* serialized_onnx_model,
size_t serialized_onnx_model_size,
181 uint32_t weight_count,
182 onnxTensorDescriptorV1
const* weight_descriptors)
237 extern "C" TENSORRTAPI
void* createNvOnnxParser_INTERNAL(
void* network,
void* logger,
int version);
238 extern "C" TENSORRTAPI
int getNvOnnxParserVersion();
247 return static_cast<IParser*>(
248 createNvOnnxParser_INTERNAL(network, logger, NV_ONNX_PARSER_VERSION));
270 return static_cast<IParser*>(
271 createNvOnnxParser_INTERNAL(&network, &logger, NV_ONNX_PARSER_VERSION));
278 #endif // NV_ONNX_PARSER_H
IParser * createParser(nvinfer1::INetworkDefinition &network, nvinfer1::ILogger &logger)
Create a new parser object.
Definition: NvOnnxParser.h:266
virtual const char * file() const =0
source file in which the error occurred
virtual bool supportsModel(void const *serialized_onnx_model, size_t serialized_onnx_model_size, SubGraphCollection_t &sub_graph_collection)=0
Check whether TensorRT supports a particular ONNX model.
A network definition for input to the builder.
Definition: NvInfer.h:4927
an object for parsing ONNX models into a TensorRT network definition
Definition: NvOnnxParser.h:125
virtual const char * func() const =0
source function in which the error occurred
virtual bool parseWithWeightDescriptors(void const *serialized_onnx_model, size_t serialized_onnx_model_size, uint32_t weight_count, onnxTensorDescriptorV1 const *weight_descriptors)=0
Parse a serialized ONNX model into the TensorRT network with consideration of user provided weights.
Application-implemented logging interface for the builder, engine and runtime.
Definition: NvInferRuntimeCommon.h:1109
The TensorRT ONNX parser API namespace.
Definition: NvOnnxConfig.h:55
std::pair< std::vector< size_t >, bool > SubGraph_t
The data structure containing the parsing capability of a set of nodes in an ONNX graph.
Definition: NvOnnxParser.h:47
virtual IParserError const * getError(int index) const =0
Get an error that occurred during prior calls to parse.
virtual bool parse(void const *serialized_onnx_model, size_t serialized_onnx_model_size)=0
Parse a serialized ONNX model into the TensorRT network. This method has very limited diagnostic....
virtual int getRefitMap(const char **weightNames, const char **layerNames, nvinfer1::WeightsRole *roles)=0
Get description of all ONNX weights that can be refitted.
virtual int getNbErrors() const =0
Get the number of errors that occurred during prior calls to parse.
virtual bool parseFromFile(const char *onnxModelFile, int verbosity)=0
Parse an onnx model file, can be a binary protobuf or a text onnx model calls parse method inside.
virtual const char * desc() const =0
description of the error
virtual void clearErrors()=0
Clear errors from prior calls to parse.
WeightsRole
How a layer uses particular Weights.
Definition: NvInferRuntime.h:718
std::vector< SubGraph_t > SubGraphCollection_t
The data structure containing all SubGraph_t partitioned out of an ONNX graph.
Definition: NvOnnxParser.h:54
virtual bool supportsOperator(const char *op_name) const =0
Returns whether the specified operator may be supported by the parser.
virtual int line() const =0
source line at which the error occurred
an object containing information about an error
Definition: NvOnnxParser.h:95
virtual int node() const =0
index of the ONNX model node in which the error occurred
virtual void destroy()=0
destroy this object
virtual ErrorCode code() const =0
the error code