TensorRT 8.6.0
nvcaffeparser1::ICaffeParser Class Referenceabstract

Class used for parsing Caffe models. More...

#include <NvCaffeParser.h>

Public Member Functions

virtual IBlobNameToTensor const * parse (char const *deploy, char const *model, nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightType) noexcept=0
 Parse a prototxt file and a binaryproto Caffe model to extract network definition and weights associated with the network, respectively. More...
 
virtual IBlobNameToTensor const * parseBuffers (uint8_t const *deployBuffer, std::size_t deployLength, uint8_t const *modelBuffer, std::size_t modelLength, nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightType) noexcept=0
 Parse a deploy prototxt and a binaryproto Caffe model from memory buffers to extract network definition and weights associated with the network, respectively. More...
 
virtual IBinaryProtoBlobparseBinaryProto (char const *fileName) noexcept=0
 Parse and extract data stored in binaryproto file. More...
 
virtual void setProtobufBufferSize (size_t size) noexcept=0
 Set buffer size for the parsing and storage of the learned model. More...
 
virtual TRT_DEPRECATED void destroy () noexcept=0
 Destroy this ICaffeParser object. More...
 
virtual void setPluginFactoryV2 (IPluginFactoryV2 *factory) noexcept=0
 Set the IPluginFactoryV2 used to create the user defined pluginV2 objects. More...
 
virtual void setPluginNamespace (char const *libNamespace) noexcept=0
 Set the namespace used to lookup and create plugins in the network. More...
 
virtual ~ICaffeParser () noexcept=default
 
virtual void setErrorRecorder (nvinfer1::IErrorRecorder *recorder) noexcept=0
 Set the ErrorRecorder for this interface. More...
 
virtual nvinfer1::IErrorRecordergetErrorRecorder () const noexcept=0
 get the ErrorRecorder assigned to this interface. More...
 

Detailed Description

Class used for parsing Caffe models.

Allows users to export models trained using Caffe to TRT.

Warning
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.

Constructor & Destructor Documentation

◆ ~ICaffeParser()

virtual nvcaffeparser1::ICaffeParser::~ICaffeParser ( )
virtualdefaultnoexcept

Member Function Documentation

◆ destroy()

virtual TRT_DEPRECATED void nvcaffeparser1::ICaffeParser::destroy ( )
pure virtualnoexcept

Destroy this ICaffeParser object.

Deprecated:
Deprecated in TensorRT 8.0. Superseded by delete.
Warning
Calling destroy on a managed pointer will result in a double-free error.

◆ getErrorRecorder()

virtual nvinfer1::IErrorRecorder * nvcaffeparser1::ICaffeParser::getErrorRecorder ( ) const
pure virtualnoexcept

get the ErrorRecorder assigned to this interface.

Retrieves the assigned error recorder object for the given class. A nullptr will be returned if setErrorRecorder has not been called.

Returns
A pointer to the IErrorRecorder object that has been registered.
See also
setErrorRecorder()

◆ parse()

virtual IBlobNameToTensor const * nvcaffeparser1::ICaffeParser::parse ( char const *  deploy,
char const *  model,
nvinfer1::INetworkDefinition network,
nvinfer1::DataType  weightType 
)
pure virtualnoexcept

Parse a prototxt file and a binaryproto Caffe model to extract network definition and weights associated with the network, respectively.

Parameters
deployThe plain text, prototxt file used to define the network definition.
modelThe binaryproto Caffe model that contains the weights associated with the network.
networkNetwork in which the CaffeParser will fill the layers.
weightTypeThe type to which the weights will transformed.
Returns
A pointer to an IBlobNameToTensor object that contains the extracted data.
See also
nvcaffeparser1::IBlobNameToTensor

◆ parseBinaryProto()

virtual IBinaryProtoBlob * nvcaffeparser1::ICaffeParser::parseBinaryProto ( char const *  fileName)
pure virtualnoexcept

Parse and extract data stored in binaryproto file.

The binaryproto file contains data stored in a binary blob. parseBinaryProto() converts it to an IBinaryProtoBlob object which gives the user access to the data and meta-data about data.

Parameters
fileNamePath to file containing binary proto.
Returns
A pointer to an IBinaryProtoBlob object that contains the extracted data.
See also
nvcaffeparser1::IBinaryProtoBlob

◆ parseBuffers()

virtual IBlobNameToTensor const * nvcaffeparser1::ICaffeParser::parseBuffers ( uint8_t const *  deployBuffer,
std::size_t  deployLength,
uint8_t const *  modelBuffer,
std::size_t  modelLength,
nvinfer1::INetworkDefinition network,
nvinfer1::DataType  weightType 
)
pure virtualnoexcept

Parse a deploy prototxt and a binaryproto Caffe model from memory buffers to extract network definition and weights associated with the network, respectively.

Parameters
deployBufferThe plain text deploy prototxt used to define the network definition.
deployLengthThe length of the deploy buffer.
modelBufferThe binaryproto Caffe memory buffer that contains the weights associated with the network.
modelLengthThe length of the model buffer.
networkNetwork in which the CaffeParser will fill the layers.
weightTypeThe type to which the weights will transformed.
Returns
A pointer to an IBlobNameToTensor object that contains the extracted data.
See also
nvcaffeparser1::IBlobNameToTensor

◆ setErrorRecorder()

virtual void nvcaffeparser1::ICaffeParser::setErrorRecorder ( nvinfer1::IErrorRecorder recorder)
pure virtualnoexcept

Set the ErrorRecorder for this interface.

Assigns the ErrorRecorder to this interface. The ErrorRecorder will track all errors during execution. This function will call incRefCount of the registered ErrorRecorder at least once. Setting recorder to nullptr unregisters the recorder with the interface, resulting in a call to decRefCount if a recorder has been registered.

If an error recorder is not set, messages will be sent to the global log stream.

Parameters
recorderThe error recorder to register with this interface.
See also
getErrorRecorder()

◆ setPluginFactoryV2()

virtual void nvcaffeparser1::ICaffeParser::setPluginFactoryV2 ( IPluginFactoryV2 factory)
pure virtualnoexcept

Set the IPluginFactoryV2 used to create the user defined pluginV2 objects.

Parameters
factoryPointer to an instance of the user implementation of IPluginFactoryV2.

◆ setPluginNamespace()

virtual void nvcaffeparser1::ICaffeParser::setPluginNamespace ( char const *  libNamespace)
pure virtualnoexcept

Set the namespace used to lookup and create plugins in the network.

◆ setProtobufBufferSize()

virtual void nvcaffeparser1::ICaffeParser::setProtobufBufferSize ( size_t  size)
pure virtualnoexcept

Set buffer size for the parsing and storage of the learned model.

Parameters
sizeThe size of the buffer specified as the number of bytes.
Note
Default size is 2^30 bytes.

The documentation for this class was generated from the following file: