23#ifndef NV_ONNX_PARSER_H
24#define NV_ONNX_PARSER_H
37#define NV_ONNX_PARSER_MAJOR 0
38#define NV_ONNX_PARSER_MINOR 1
39#define NV_ONNX_PARSER_PATCH 0
41static constexpr int32_t NV_ONNX_PARSER_VERSION
69constexpr inline int32_t
EnumMax() noexcept;
149 virtual char const*
desc()
const = 0;
153 virtual char const*
file()
const = 0;
161 virtual char const*
func()
const = 0;
214 void const* serialized_onnx_model,
size_t serialized_onnx_model_size,
const char* model_path =
nullptr) noexcept
227 virtual
bool parseFromFile(const
char* onnxModelFile,
int verbosity) noexcept = 0;
256 void const* serialized_onnx_model,
size_t serialized_onnx_model_size) noexcept
388 void const* serializedOnnxModel,
size_t serializedOnnxModelSize,
char const* modelPath =
nullptr) noexcept = 0;
419 virtual int64_t*
getSubgraphNodes(int64_t const index, int64_t& subgraphLength) noexcept = 0;
443 void const* serializedOnnxModel,
size_t serializedOnnxModelSize,
char const* modelPath =
nullptr) noexcept
456 virtual
bool refitFromFile(
char const* onnxModelFile) noexcept = 0;
486 void* refitter,
void* logger, int32_t version) noexcept;
516 catch (std::exception& e)
540 catch (std::exception& e)
#define TENSORRTAPI
Definition: NvInferRuntimeBase.h:59
#define TRT_DEPRECATED
Definition: NvInferRuntimeBase.h:45
TENSORRTAPI void * createNvOnnxParserRefitter_INTERNAL(void *refitter, void *logger, int32_t version) noexcept
std::vector< SubGraph_t > SubGraphCollection_t
The data structure containing all SubGraph_t partitioned out of an ONNX graph.
Definition: NvOnnxParser.h:58
TENSORRTAPI void * createNvOnnxParser_INTERNAL(void *network, void *logger, int version) noexcept
TENSORRTAPI int getNvOnnxParserVersion() noexcept
#define NV_ONNX_PARSER_PATCH
Definition: NvOnnxParser.h:39
#define NV_ONNX_PARSER_MINOR
Definition: NvOnnxParser.h:38
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:50
#define NV_ONNX_PARSER_MAJOR
Definition: NvOnnxParser.h:37
Application-implemented logging interface for the builder, refitter and runtime.
Definition: NvInferRuntimeBase.h:683
@ kINTERNAL_ERROR
An internal error has occurred. Execution is unrecoverable.
A network definition for input to the builder.
Definition: NvInfer.h:6223
Updates weights in an engine.
Definition: NvInferRuntime.h:1624
an object containing information about an error
Definition: NvOnnxParser.h:140
virtual char const * nodeOperator() const =0
name of the node operation in which the error occurred.
virtual char const * func() const =0
source function in which the error occurred.
virtual int line() const =0
source line at which the error occurred.
virtual char const * desc() const =0
description of the error.
virtual ~IParserError()
Definition: NvOnnxParser.h:188
virtual ErrorCode code() const =0
the error code.
virtual char const * nodeName() const =0
name of the node in which the error occurred.
virtual char const *const * localFunctionStack() const =0
A list of the local function names, from the top level down, constituting the current stack trace in ...
virtual int node() const =0
index of the ONNX model node in which the error occurred.
virtual char const * file() const =0
source file in which the error occurred.
virtual int32_t localFunctionStackSize() const =0
The size of the stack of local functions at the point where the error occurred. A top-level node that...
an object for parsing ONNX models into a TensorRT network definition
Definition: NvOnnxParser.h:197
virtual IParserError const * getError(int index) const noexcept=0
Get an error that occurred during prior calls to parse.
virtual char const *const * getUsedVCPluginLibraries(int64_t &nbPluginLibs) const noexcept=0
Query the plugin libraries needed to implement operations used by the parser in a version-compatible ...
virtual void setFlag(OnnxParserFlag onnxParserFlag) noexcept=0
Set a single parser flag.
virtual bool parseWithWeightDescriptors(void const *serialized_onnx_model, size_t serialized_onnx_model_size) noexcept=0
Parse a serialized ONNX model into the TensorRT network with consideration of user provided weights.
virtual bool supportsOperator(const char *op_name) const noexcept=0
Returns whether the specified operator may be supported by the parser.
virtual bool supportsModelV2(void const *serializedOnnxModel, size_t serializedOnnxModelSize, char const *modelPath=nullptr) noexcept=0
Check whether TensorRT supports a particular ONNX model. If the function returns True,...
virtual void clearErrors() noexcept=0
Clear errors from prior calls to parse.
virtual TRT_DEPRECATED bool supportsModel(void const *serialized_onnx_model, size_t serialized_onnx_model_size, SubGraphCollection_t &sub_graph_collection, const char *model_path=nullptr) noexcept=0
Check whether TensorRT supports a particular ONNX model. If the function returns True,...
virtual bool getFlag(OnnxParserFlag onnxParserFlag) const noexcept=0
Returns true if the parser flag is set.
virtual void clearFlag(OnnxParserFlag onnxParserFlag) noexcept=0
clear a parser flag.
virtual OnnxParserFlags getFlags() const noexcept=0
Get the parser flags. Defaults to 0.
virtual bool parseFromFile(const char *onnxModelFile, int verbosity) noexcept=0
Parse an onnx model file, which can be a binary protobuf or a text onnx model calls parse method insi...
virtual bool isSubgraphSupported(int64_t const index) noexcept=0
Returns whether the subgraph is supported. Calling this function before calling supportsModelV2 resul...
virtual int64_t getNbSubgraphs() noexcept=0
Get the number of subgraphs. Calling this function before calling supportsModelV2 results in undefine...
virtual int64_t * getSubgraphNodes(int64_t const index, int64_t &subgraphLength) noexcept=0
Get the nodes of the specified subgraph. Calling this function before calling supportsModelV2 results...
virtual void setFlags(OnnxParserFlags onnxParserFlags) noexcept=0
Set the parser flags.
virtual bool parse(void const *serialized_onnx_model, size_t serialized_onnx_model_size, const char *model_path=nullptr) noexcept=0
Parse a serialized ONNX model into the TensorRT network. This method has very limited diagnostics....
virtual int getNbErrors() const noexcept=0
Get the number of errors that occurred during prior calls to parse.
virtual nvinfer1::ITensor const * getLayerOutputTensor(char const *name, int64_t i) noexcept=0
Return the i-th output ITensor object for the ONNX layer "name".
An interface designed to refit weights from an ONNX model.
Definition: NvOnnxParser.h:428
virtual bool refitFromBytes(void const *serializedOnnxModel, size_t serializedOnnxModelSize, char const *modelPath=nullptr) noexcept=0
Load a serialized ONNX model from memory and perform weight refit.
The TensorRT API version 1 namespace.
IParser * createParser(nvinfer1::INetworkDefinition &network, nvinfer1::ILogger &logger) noexcept
Create a new parser object.
Definition: NvOnnxParser.h:510
IParserRefitter * createParserRefitter(nvinfer1::IRefitter &refitter, nvinfer1::ILogger &logger) noexcept
Create a new ONNX refitter object.
Definition: NvOnnxParser.h:533
The TensorRT ONNX parser API namespace.
Definition: NvOnnxConfig.h:24
uint32_t OnnxParserFlags
Represents one or more OnnxParserFlag values using binary OR operations, e.g., 1U << OnnxParserFlag::...
Definition: NvOnnxParser.h:112
constexpr int32_t EnumMax() noexcept
ErrorCode
The type of error that the parser or refitter may return.
Definition: NvOnnxParser.h:77
@ kUNSUPPORTED_NODE_DYNAMIC
@ kUNSUPPORTED_NODE_INPUT
@ kUNSUPPORTED_NODE_DATATYPE
@ kMODEL_DESERIALIZE_FAILED
@ kUNSUPPORTED_NODE_SHAPE
OnnxParserFlag
Definition: NvOnnxParser.h:115
constexpr int32_t EnumMax< ErrorCode >() noexcept
Definition: NvOnnxParser.h:101
constexpr int32_t EnumMax< OnnxParserFlag >() noexcept
Definition: NvOnnxParser.h:129