Onnx Parser¶
-
class
tensorrt.
OnnxParser
(self: tensorrt.tensorrt.OnnxParser, network: tensorrt.tensorrt.INetworkDefinition, logger: tensorrt.tensorrt.ILogger) → None¶ This class is used for parsing Onnx models into a TensorRT network definition
Variables: num_errors –
int
The number of errors that occurred during prior calls toparse()
Parameters: - network – The network definition to which the parser will write.
- logger – The logger to use.
-
__del__
(self: tensorrt.tensorrt.OnnxParser) → None¶
-
__exit__
(exc_type, exc_value, traceback)¶ Destroy this object, freeing all memory associated with it. This should be called to ensure that the object is cleaned up properly. Equivalent to invoking
__del__()
-
__init__
(self: tensorrt.tensorrt.OnnxParser, network: tensorrt.tensorrt.INetworkDefinition, logger: tensorrt.tensorrt.ILogger) → None¶ Parameters: - network – The network definition to which the parser will write.
- logger – The logger to use.
-
get_error
(self: tensorrt.tensorrt.OnnxParser, index: int) → nvonnxparser::IParserError¶ Get an error that occurred during prior calls to
parse()
Parameters: index – Index of the error
-
parse
(self: tensorrt.tensorrt.OnnxParser, model: str) → bool¶ Parse a serialized Onnx model into the TensorRT network. 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: model – The serialized Onnx model object. Returns: true if the model was parsed successfully
-
supports_operator
(self: tensorrt.tensorrt.OnnxParser, op_name: str) → bool¶ Returns whether the specified operator may be supported by the parser.
Parameters: op_name – The name of the Onnx operator to check for support
-
tensorrt.
ErrorCode
¶ The type of parser error
Members:
INVALID_NODE
MODEL_DESERIALIZE_FAILED
SUCCESS
INVALID_VALUE
MEM_ALLOC_FAILED
INTERNAL_ERROR
UNSUPPORTED_GRAPH
UNSUPPORTED_NODE
INVALID_GRAPH
-
class
tensorrt.
ParserError
¶ -
code
(self: tensorrt.tensorrt.ParserError) → tensorrt.tensorrt.ErrorCode¶ Returns: The error code
-
desc
(self: tensorrt.tensorrt.ParserError) → str¶ Returns: Description of the error
-
file
(self: tensorrt.tensorrt.ParserError) → str¶ Returns: Source file in which the error occurred
-
func
(self: tensorrt.tensorrt.ParserError) → str¶ Returns: Source function in which the error occurred
-
line
(self: tensorrt.tensorrt.ParserError) → int¶ Returns: Source line at which the error occurred
-
node
(self: tensorrt.tensorrt.ParserError) → int¶ Returns: Index of the Onnx model node in which the error occurred
-