an object for parsing ONNX models into a TensorRT network definition
More...
|
virtual bool | parse (void const *serialized_onnx_model, size_t serialized_onnx_model_size)=0 |
| Parse a serialized ONNX model into the TensorRT network. 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 More...
|
|
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...
|
|
virtual int | getRefitMap (const char **weightNames, const char **layerNames, nvinfer1::WeightsRole *roles)=0 |
| Get description of all ONNX weights that can be refitted. More...
|
|
an object for parsing ONNX models into a TensorRT network definition
◆ ~IParser()
virtual nvonnxparser::IParser::~IParser |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ 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_model | Pointer to the serialized ONNX model |
serialized_onnx_model_size | Size 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
-
- Returns
- true if the model was parsed successfully
◆ 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_model | Pointer to the serialized ONNX model |
serialized_onnx_model_size | Size of the serialized ONNX model in bytes |
sub_graph_collection | Container to hold supported subgraphs |
- Returns
- true if the model is supported
◆ 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_model | Pointer to the serialized ONNX model |
serialized_onnx_model_size | Size of the serialized ONNX model in bytes |
weight_count | number of user provided weights |
weight_descriptors | pointer to user provided weight array |
- Returns
- true if the model was parsed successfully
- See also
- getNbErrors() getError()
◆ 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_name | The name of the ONNX operator to check for support |
◆ destroy()
virtual void nvonnxparser::IParser::destroy |
( |
| ) |
|
|
pure virtual |
◆ getNbErrors()
virtual int nvonnxparser::IParser::getNbErrors |
( |
| ) |
const |
|
pure virtual |
◆ getError()
virtual IParserError const* nvonnxparser::IParser::getError |
( |
int |
index | ) |
const |
|
pure virtual |
◆ clearErrors()
virtual void nvonnxparser::IParser::clearErrors |
( |
| ) |
|
|
pure virtual |
◆ getRefitMap()
virtual int nvonnxparser::IParser::getRefitMap |
( |
const char ** |
weightNames, |
|
|
const char ** |
layerNames, |
|
|
nvinfer1::WeightsRole * |
roles |
|
) |
| |
|
pure virtual |
Get description of all ONNX weights that can be refitted.
- Parameters
-
weightsNames | Where to write the weight names to |
layerNames | Where to write the layer names to |
roles | Where to write the roles to |
- Returns
- The number of weights from the ONNX model that can be refitted
If weightNames or layerNames != nullptr, each written pointer points to a string owned by the parser, and becomes invalid when the parser is destroyed
If the same weight is used in multiple TRT layers it will be represented as a new entry in weightNames with name <weightName>_x, with x being the number of times the weight has been used before the current layer
The documentation for this class was generated from the following file: