TensorRT  7.1.0.16
nvonnxparser::IParser Class Referenceabstract

an object for parsing ONNX models into a TensorRT network definition More...

#include <NvOnnxParser.h>

Public Member Functions

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. If parsing the serialized model fails for any reason (e.g. unsupported IR version, unsupported opset, etc.) it the user responsibility to intercept and report the error. To obtain a better diagnostic, use the parseFromFile method below. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual bool supportsOperator (const char *op_name) const =0
 Returns whether the specified operator may be supported by the parser. More...
 
virtual void destroy ()=0
 destroy this object
 
virtual int getNbErrors () const =0
 Get the number of errors that occurred during prior calls to parse. More...
 
virtual IParserError const * getError (int index) const =0
 Get an error that occurred during prior calls to parse. More...
 
virtual void clearErrors ()=0
 Clear errors from prior calls to parse. More...
 

Detailed Description

an object for parsing ONNX models into a TensorRT network definition

Member Function Documentation

◆ clearErrors()

virtual void nvonnxparser::IParser::clearErrors ( )
pure virtual

Clear errors from prior calls to parse.

See also
getNbErrors() getError() IParserError

◆ getError()

virtual IParserError const* nvonnxparser::IParser::getError ( int  index) const
pure virtual

Get an error that occurred during prior calls to parse.

See also
getNbErrors() clearErrors() IParserError

◆ getNbErrors()

virtual int nvonnxparser::IParser::getNbErrors ( ) const
pure virtual

Get the number of errors that occurred during prior calls to parse.

See also
getError() clearErrors() IParserError

◆ parse()

virtual bool nvonnxparser::IParser::parse ( void const *  serialized_onnx_model,
size_t  serialized_onnx_model_size 
)
pure virtual

Parse a serialized ONNX model into the TensorRT network. This method has very limited diagnostic. If parsing the serialized model fails for any reason (e.g. unsupported IR version, unsupported opset, etc.) it the user responsibility to intercept and report the error. To obtain a better diagnostic, use the parseFromFile method below.

Parameters
serialized_onnx_modelPointer to the serialized ONNX model
serialized_onnx_model_sizeSize of the serialized ONNX model in bytes
Returns
true if the model was parsed successfully
See also
getNbErrors() getError()

◆ parseFromFile()

virtual bool nvonnxparser::IParser::parseFromFile ( const char *  onnxModelFile,
int  verbosity 
)
pure virtual

Parse an onnx model file, can be a binary protobuf or a text onnx model calls parse method inside.

Parameters
Filename
VerbosityLevel
Returns
true if the model was parsed successfully

◆ parseWithWeightDescriptors()

virtual bool nvonnxparser::IParser::parseWithWeightDescriptors ( void const *  serialized_onnx_model,
size_t  serialized_onnx_model_size,
uint32_t  weight_count,
onnxTensorDescriptorV1 const *  weight_descriptors 
)
pure virtual

Parse a serialized ONNX model into the TensorRT network with consideration of user provided weights.

Parameters
serialized_onnx_modelPointer to the serialized ONNX model
serialized_onnx_model_sizeSize of the serialized ONNX model in bytes
weight_countnumber of user provided weights
weight_descriptorspointer to user provided weight array
Returns
true if the model was parsed successfully
See also
getNbErrors() getError()

◆ supportsModel()

virtual bool nvonnxparser::IParser::supportsModel ( void const *  serialized_onnx_model,
size_t  serialized_onnx_model_size,
SubGraphCollection_t sub_graph_collection 
)
pure virtual

Check whether TensorRT supports a particular ONNX model.

Parameters
serialized_onnx_modelPointer to the serialized ONNX model
serialized_onnx_model_sizeSize of the serialized ONNX model in bytes
sub_graph_collectionContainer to hold supported subgraphs
Returns
true if the model is supported

◆ supportsOperator()

virtual bool nvonnxparser::IParser::supportsOperator ( const char *  op_name) const
pure virtual

Returns whether the specified operator may be supported by the parser.

Note that a result of true does not guarantee that the operator will be supported in all cases (i.e., this function may return false-positives).

Parameters
op_nameThe name of the ONNX operator to check for support

The documentation for this class was generated from the following file: