|
| 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. 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 (char const *onnxModelFile, int verbosity) noexcept=0 |
| | Parse an onnx model file, which can be a binary protobuf or a text onnx model calls parse method inside. More...
|
| |
| virtual bool | supportsOperator (const char *op_name) const noexcept=0 |
| | Returns whether the specified operator may be supported by the parser. More...
|
| |
| virtual int | getNbErrors () const noexcept=0 |
| | Get the number of errors that occurred during prior calls to parse. More...
|
| |
| virtual IParserError const * | getError (int index) const noexcept=0 |
| | Get an error that occurred during prior calls to parse. More...
|
| |
| virtual void | clearErrors () noexcept=0 |
| | Clear errors from prior calls to parse. More...
|
| |
| virtual | ~IParser () noexcept=default |
| |
| 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 engine. More...
|
| |
| virtual void | setFlags (OnnxParserFlags onnxParserFlags) noexcept=0 |
| | Set the parser flags. More...
|
| |
| virtual OnnxParserFlags | getFlags () const noexcept=0 |
| | Get the parser flags. Defaults to 0. More...
|
| |
| virtual void | clearFlag (OnnxParserFlag onnxParserFlag) noexcept=0 |
| | clear a parser flag. More...
|
| |
| virtual void | setFlag (OnnxParserFlag onnxParserFlag) noexcept=0 |
| | Set a single parser flag. More...
|
| |
| virtual bool | getFlag (OnnxParserFlag onnxParserFlag) const noexcept=0 |
| | Returns true if the parser flag is set. More...
|
| |
| 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". More...
|
| |
| 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, one can proceed to engine building without having to call parse or parseFromFile. Results can be queried through getNbSubgraphs, isSubgraphSupported, getSubgraphNodes. More...
|
| |
| virtual int64_t | getNbSubgraphs () noexcept=0 |
| | Get the number of subgraphs. Calling this function before calling supportsModelV2 results in undefined behavior. More...
|
| |
| virtual bool | isSubgraphSupported (int64_t const index) noexcept=0 |
| | Returns whether the subgraph is supported. Calling this function before calling supportsModelV2 results in undefined behavior. More...
|
| |
| 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 in undefined behavior. More...
|
| |
| virtual bool | loadModelProto (void const *serializedOnnxModel, size_t serializedOnnxModelSize, char const *modelPath=nullptr) noexcept=0 |
| | Load a serialized ONNX model into the parser. Unlike the parse() or parseFromFile() functions, this function does not immediately convert the model into a TensorRT INetworkDefinition. Using this function allows users to provide their own initializers for the ONNX model through the loadInitializer() function. More...
|
| |
| virtual bool | loadInitializer (char const *name, void const *data, size_t size) noexcept=0 |
| | Prompt the ONNX parser to load an initializer with user-provided binary data. The lifetime of the data must exceed the lifetime of the parser. More...
|
| |
| virtual bool | parseModelProto () noexcept=0 |
| | Begin the parsing and conversion process of the loaded ONNX model into a TensorRT INetworkDefinition. More...
|
| |
| virtual bool | setBuilderConfig (const nvinfer1::IBuilderConfig *const builderConfig) noexcept=0 |
| | Set the BuilderConfig for the parser. More...
|
| |
| virtual void | setRefitObserver (IRefitterObserver *observer) noexcept=0 |
| | Set or clear an optional observer notified once per refittable weight during parsing. More...
|
| |
an object for parsing ONNX models into a TensorRT network definition
- Warning
- If the ONNX model has a graph output with the same name as a graph input, the output will be renamed by prepending "__".
-
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.
Set or clear an optional observer notified once per refittable weight during parsing.
When attached, the parser emits one RefitRecord per network weight it names via INetworkDefinition::setWeightsName, at the moment the weight is created during parse/parseModelProto. This is the same record schema emitted by IParserRefitter::setRefitObserver during refit, produced without building or deserializing an engine. Because the network has not been built yet, the records are a candidate superset of the built engine's refittable weights: the builder may fold or absorb some of them. Consumers replaying the records against an engine must skip records whose trtName the engine's nvinfer1::IRefitter does not report in getAllWeights, and rely on refitCudaEngine's missing-weights check for coverage.
TensorRT-RTX only: When an observer is attached to the parser associated with a BuilderConfig that sets kREFIT_INDIVIDUAL and kSTRIP_PLAN, the parser will provide placeholder weights for the listed initializers of the following ONNX nodes:
- Conv kernels and biases
- Gemm operands and bias
- MatMul operands
- DequantizeLinear scales
- DequantizeLinear FP8 or FP4 data
- TRT_FP8DequantizeLinear/TRT_MXFP8DequantizeLinear FP8 data A placeholder weight is represented by nvinfer1::Weights with the same type and count as the original initializer, but with nullptr values. All placeholder weights are expected to be refit prior to inference.
A placeholder weight will not be produced under the following circumstances:
- If the initializer is also a graph input or output
- If the initializer is referenced by a nested graph
Placeholders will not be created when importing a model whose producer name is "TensorRT". Networks containing placeholders must be built with IBuilder::buildSerializedNetwork().
Records are only valid if the subsequent parse call returns true.
May be called any time before parse / parseModelProto. Pass nullptr to detach. The observer must outlive the parse call, or be detached before destruction. Ownership remains with the caller.
- See also
- IRefitterObserver IParserRefitter::setRefitObserver