Caffe Parser¶
-
class
tensorrt.
IBlobNameToTensor
¶ This class is used to store and query
ITensor
s after they have been extracted from a Caffe model using theCaffeParser
.
-
class
tensorrt.
CaffeParser
(self: tensorrt.tensorrt.CaffeParser) → None¶ This class is used for parsing Caffe models. It allows users to export models trained using Caffe to TRT.
- Variables
plugin_factory_v2 –
ICaffePluginFactoryV2
The ICaffePluginFactory used to create the user defined plugins.plugin_namespace –
str
The namespace used to lookup and create plugins in the network.protobuf_buffer_size –
int
The buffer size for the parsing and storage of the learned model.error_recorder –
IErrorRecorder
Application-implemented error reporting interface for TensorRT objects.
-
__del__
(self: tensorrt.tensorrt.CaffeParser) → None¶
-
__exit__
(exc_type, exc_value, traceback)¶ Context managers are deprecated and have no effect. Objects are automatically freed when the reference count reaches 0.
-
__init__
(self: tensorrt.tensorrt.CaffeParser) → None¶
-
parse
(self: tensorrt.tensorrt.CaffeParser, deploy: str, model: str, network: tensorrt.tensorrt.INetworkDefinition, dtype: tensorrt.tensorrt.DataType) → tensorrt.tensorrt.IBlobNameToTensor¶ Parse a prototxt file and a binaryproto Caffe model to extract network definition and weights associated with the network, respectively.
- Parameters
deploy – The plain text, prototxt file used to define the network definition.
model – The binaryproto Caffe model that contains the weights associated with the network.
network – Network in which the CaffeParser will fill the layers.
dtype – The type to which the weights will be transformed.
- Returns
An
IBlobNameToTensor
object that contains the extracted data.
-
parse_binary_proto
(self: tensorrt.tensorrt.CaffeParser, filename: str) → numpy.ndarray¶ Parse and extract data stored in binaryproto file. The binaryproto file contains data stored in a binary blob.
parse_binary_proto()
converts it to annumpy.ndarray
object.- Parameters
filename – Path to file containing binary proto.
- Returns
numpy.ndarray
An array that contains the extracted data.
-
parse_buffer
(self: tensorrt.tensorrt.CaffeParser, deploy_buffer: buffer, model_buffer: buffer, network: tensorrt.tensorrt.INetworkDefinition, dtype: tensorrt.tensorrt.DataType) → tensorrt.tensorrt.IBlobNameToTensor¶ Parse a prototxt file and a binaryproto Caffe model to extract network definition and weights associated with the network, respectively.
- Parameters
deploy_buffer – The memory buffer containing the plain text deploy prototxt used to define the network definition.
model_buffer – The binaryproto Caffe memory buffer that contains the weights associated with the network.
network – Network in which the CaffeParser will fill the layers.
dtype – The type to which the weights will be transformed.
- Returns
An
IBlobNameToTensor
object that contains the extracted data.
-
tensorrt.
shutdown_protobuf_library
() → None¶ Shuts down protocol buffers library.