# 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 the CaffeParser .

find(self: tensorrt.tensorrt.IBlobNameToTensor, name: str) → tensorrt.tensorrt.ITensor

Given a blob name, this function returns an ITensor object.

Parameters: name – Caffe blob name for which the user wants the corresponding ITensor . A ITensor object corresponding to the queried name. If no such ITensor exists, then an empty object is returned.
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 – ICaffePluginFactory The ICaffePluginFactory used to create the user defined plugins. plugin_factory_ext – ICaffePluginFactoryExt The ICaffePluginFactoryExt used to create the user defined pluginExts. 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.
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 configuration and weights associated with the network, respectively.

Parameters: deploy – The plain text, prototxt file used to define the network configuration. 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. An IBlobNameToTensor object that contains the extracted data.
parse_binary_proto(self: tensorrt.tensorrt.CaffeParser, filename: str) → array

Parse and extract data stored in binaryproto file. The binaryproto file contains data stored in a binary blob. parse_binary_proto() converts it to an numpy.ndarray object.

Parameters: filename – Path to file containing binary proto. 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 configuration and weights associated with the network, respectively.

Parameters: deploy_buffer – The memory buffer containing the plain text deploy prototxt used to define the network configuration. 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. An IBlobNameToTensor object that contains the extracted data.
tensorrt.shutdown_protobuf_library() → None

Shuts down protocol buffers library.