TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
nvcaffeparser1::CaffeParser Class Referenceabstract
Inheritance diagram for nvcaffeparser1::CaffeParser:
Collaboration diagram for nvcaffeparser1::CaffeParser:

Public Member Functions

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

Private Member Functions

 ~CaffeParser () override
 
std::vector< nvinfer1::PluginFieldparseNormalizeParam (const trtcaffe::LayerParameter &msg, CaffeWeightFactory &weightFactory, BlobNameToTensor &tensors)
 
std::vector< nvinfer1::PluginFieldparsePriorBoxParam (const trtcaffe::LayerParameter &msg, CaffeWeightFactory &weightFactory, BlobNameToTensor &tensors)
 
std::vector< nvinfer1::PluginFieldparseDetectionOutputParam (const trtcaffe::LayerParameter &msg, CaffeWeightFactory &weightFactory, BlobNameToTensor &tensors)
 
std::vector< nvinfer1::PluginFieldparseLReLUParam (const trtcaffe::LayerParameter &msg, CaffeWeightFactory &weightFactory, BlobNameToTensor &tensors)
 
std::vector< nvinfer1::PluginFieldparseRPROIParam (const trtcaffe::LayerParameter &msg, CaffeWeightFactory &weightFactory, BlobNameToTensor &tensors)
 
template<typename T >
T * allocMemory (int size=1)
 
const IBlobNameToTensorparse (nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightType, bool hasModel)
 

Private Attributes

std::shared_ptr< trtcaffe::NetParameter > mDeploy
 
std::shared_ptr< trtcaffe::NetParameter > mModel
 
std::vector< void * > mTmpAllocs
 
BlobNameToTensormBlobNameToTensor {nullptr}
 
size_t mProtobufBufferSize {INT_MAX}
 
nvcaffeparser1::IPluginFactorymPluginFactory {nullptr}
 
nvcaffeparser1::IPluginFactoryV2mPluginFactoryV2 {nullptr}
 
bool mPluginFactoryIsExt {false}
 
std::vector< nvinfer1::IPluginV2 * > mNewPlugins
 
std::unordered_map< std::string, nvinfer1::IPluginCreator * > mPluginRegistry
 
std::string mPluginNamespace = ""
 

Constructor & Destructor Documentation

◆ ~CaffeParser()

CaffeParser::~CaffeParser ( )
overrideprivate

Member Function Documentation

◆ parse() [1/2]

const IBlobNameToTensor * CaffeParser::parse ( const char *  deploy,
const char *  model,
nvinfer1::INetworkDefinition network,
nvinfer1::DataType  weightType 
)
overridevirtual

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

Implements nvcaffeparser1::ICaffeParser.

Here is the call graph for this function:

◆ parseBuffers() [1/2]

const IBlobNameToTensor * CaffeParser::parseBuffers ( const char *  deployBuffer,
size_t  deployLength,
const char *  modelBuffer,
size_t  modelLength,
nvinfer1::INetworkDefinition network,
nvinfer1::DataType  weightType 
)
override

◆ setProtobufBufferSize()

void nvcaffeparser1::CaffeParser::setProtobufBufferSize ( size_t  size)
inlineoverridevirtual

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.

Implements nvcaffeparser1::ICaffeParser.

◆ setPluginFactory()

void nvcaffeparser1::CaffeParser::setPluginFactory ( nvcaffeparser1::IPluginFactory factory)
inlineoverridevirtual

Set the IPluginFactory used to create the user defined plugins.

Parameters
factoryPointer to an instance of the user implmentation of IPluginFactory.

Implements nvcaffeparser1::ICaffeParser.

◆ setPluginFactoryExt()

void nvcaffeparser1::CaffeParser::setPluginFactoryExt ( nvcaffeparser1::IPluginFactoryExt factory)
inlineoverridevirtual

Set the IPluginFactoryExt used to create the user defined pluginExts.

Parameters
factoryPointer to an instance of the user implmentation of IPluginFactoryExt.

Implements nvcaffeparser1::ICaffeParser.

◆ setPluginFactoryV2()

void nvcaffeparser1::CaffeParser::setPluginFactoryV2 ( nvcaffeparser1::IPluginFactoryV2 factory)
inlineoverridevirtual

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

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

Implements nvcaffeparser1::ICaffeParser.

◆ setPluginNamespace()

void nvcaffeparser1::CaffeParser::setPluginNamespace ( const char *  libNamespace)
inlineoverridevirtual

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

Implements nvcaffeparser1::ICaffeParser.

◆ parseBinaryProto()

IBinaryProtoBlob * CaffeParser::parseBinaryProto ( const char *  fileName)
overridevirtual

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

Implements nvcaffeparser1::ICaffeParser.

◆ destroy()

void nvcaffeparser1::CaffeParser::destroy ( )
inlineoverridevirtual

Destroy this ICaffeParser object.

Implements nvcaffeparser1::ICaffeParser.

◆ setErrorRecorder()

void nvcaffeparser1::CaffeParser::setErrorRecorder ( nvinfer1::IErrorRecorder recorder)
inlineoverridevirtual

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.

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

Implements nvcaffeparser1::ICaffeParser.

◆ getErrorRecorder()

nvinfer1::IErrorRecorder* nvcaffeparser1::CaffeParser::getErrorRecorder ( ) const
inlineoverridevirtual

get the ErrorRecorder assigned to this interface.

Retrieves the assigned error recorder object for the given class. A default error recorder does not exist, so 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

Implements nvcaffeparser1::ICaffeParser.

◆ parseNormalizeParam()

std::vector< nvinfer1::PluginField > CaffeParser::parseNormalizeParam ( const trtcaffe::LayerParameter &  msg,
CaffeWeightFactory weightFactory,
BlobNameToTensor tensors 
)
private
Here is the call graph for this function:

◆ parsePriorBoxParam()

std::vector< nvinfer1::PluginField > CaffeParser::parsePriorBoxParam ( const trtcaffe::LayerParameter &  msg,
CaffeWeightFactory weightFactory,
BlobNameToTensor tensors 
)
private

◆ parseDetectionOutputParam()

std::vector< nvinfer1::PluginField > CaffeParser::parseDetectionOutputParam ( const trtcaffe::LayerParameter &  msg,
CaffeWeightFactory weightFactory,
BlobNameToTensor tensors 
)
private

◆ parseLReLUParam()

std::vector< nvinfer1::PluginField > CaffeParser::parseLReLUParam ( const trtcaffe::LayerParameter &  msg,
CaffeWeightFactory weightFactory,
BlobNameToTensor tensors 
)
private

◆ parseRPROIParam()

std::vector< nvinfer1::PluginField > CaffeParser::parseRPROIParam ( const trtcaffe::LayerParameter &  msg,
CaffeWeightFactory weightFactory,
BlobNameToTensor tensors 
)
private

◆ allocMemory()

template<typename T >
T* nvcaffeparser1::CaffeParser::allocMemory ( int  size = 1)
inlineprivate

◆ parse() [2/2]

const IBlobNameToTensor * CaffeParser::parse ( nvinfer1::INetworkDefinition network,
nvinfer1::DataType  weightType,
bool  hasModel 
)
private
Here is the call graph for this function:

◆ parseBuffers() [2/2]

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

Parse a deploy prototxt 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

Member Data Documentation

◆ mDeploy

std::shared_ptr<trtcaffe::NetParameter> nvcaffeparser1::CaffeParser::mDeploy
private

◆ mModel

std::shared_ptr<trtcaffe::NetParameter> nvcaffeparser1::CaffeParser::mModel
private

◆ mTmpAllocs

std::vector<void*> nvcaffeparser1::CaffeParser::mTmpAllocs
private

◆ mBlobNameToTensor

BlobNameToTensor* nvcaffeparser1::CaffeParser::mBlobNameToTensor {nullptr}
private

◆ mProtobufBufferSize

size_t nvcaffeparser1::CaffeParser::mProtobufBufferSize {INT_MAX}
private

◆ mPluginFactory

nvcaffeparser1::IPluginFactory* nvcaffeparser1::CaffeParser::mPluginFactory {nullptr}
private

◆ mPluginFactoryV2

nvcaffeparser1::IPluginFactoryV2* nvcaffeparser1::CaffeParser::mPluginFactoryV2 {nullptr}
private

◆ mPluginFactoryIsExt

bool nvcaffeparser1::CaffeParser::mPluginFactoryIsExt {false}
private

◆ mNewPlugins

std::vector<nvinfer1::IPluginV2*> nvcaffeparser1::CaffeParser::mNewPlugins
private

◆ mPluginRegistry

std::unordered_map<std::string, nvinfer1::IPluginCreator*> nvcaffeparser1::CaffeParser::mPluginRegistry
private

◆ mPluginNamespace

std::string nvcaffeparser1::CaffeParser::mPluginNamespace = ""
private

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