TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
nvinfer1::IRefitter Class Referenceabstract

Updates weights in an engine. More...

Public Member Functions

virtual bool setWeights (const char *layerName, WeightsRole role, Weights weights)=0
 Specify new weights for a layer of given name. More...
 
virtual bool refitCudaEngine ()=0
 Updates associated engine. More...
 
virtual int32_t getMissing (int32_t size, const char **layerNames, WeightsRole *roles)=0
 Get description of missing weights. More...
 
virtual int32_t getAll (int32_t size, const char **layerNames, WeightsRole *roles)=0
 Get description of all weights that could be refit. More...
 
virtual void destroy ()=0
 
virtual bool setDynamicRange (const char *tensorName, float min, float max)=0
 Update dynamic range for a tensor. More...
 
virtual float getDynamicRangeMin (const char *tensorName) const =0
 Get minimum of dynamic range. More...
 
virtual float getDynamicRangeMax (const char *tensorName) const =0
 Get maximum of dynamic range. More...
 
virtual int32_t getTensorsWithDynamicRange (int32_t size, const char **tensorNames) const =0
 Get names of all tensors that have refittable dynamic ranges. More...
 
virtual void setErrorRecorder (IErrorRecorder *recorder)=0
 Set the ErrorRecorder for this interface. More...
 
virtual IErrorRecordergetErrorRecorder () const =0
 get the ErrorRecorder assigned to this interface. More...
 

Protected Member Functions

virtual ~IRefitter ()
 

Detailed Description

Updates weights in an engine.

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

Constructor & Destructor Documentation

◆ ~IRefitter()

virtual nvinfer1::IRefitter::~IRefitter ( )
inlineprotectedvirtual

Member Function Documentation

◆ setWeights()

virtual bool nvinfer1::IRefitter::setWeights ( const char *  layerName,
WeightsRole  role,
Weights  weights 
)
pure virtual

Specify new weights for a layer of given name.

Returns true on success, or false if new weights are rejected. Possible reasons for rejection are:

  • There is no such layer by that name.
  • The layer does not have weights with the specified role.
  • The number of weights is inconsistent with the layer’s original specification.

Modifying the weights before method refit() completes will result in undefined behavior.

◆ refitCudaEngine()

virtual bool nvinfer1::IRefitter::refitCudaEngine ( )
pure virtual

Updates associated engine.

Return true if successful.

Failure occurs if getMissing() != 0 before the call.

◆ getMissing()

virtual int32_t nvinfer1::IRefitter::getMissing ( int32_t  size,
const char **  layerNames,
WeightsRole roles 
)
pure virtual

Get description of missing weights.

For example, if some Weights have been set, but the engine was optimized in a way that combines weights, any unsupplied Weights in the combination are considered missing.

Parameters
sizeThe number of items that can be safely written to a non-null layerNames or roles.
layerNamesWhere to write the layer names.
rolesWhere to write the weights roles.
Returns
The number of missing Weights.

If layerNames!=nullptr, each written pointer points to a string owned by the engine being refitted, and becomes invalid when the engine is destroyed.

◆ getAll()

virtual int32_t nvinfer1::IRefitter::getAll ( int32_t  size,
const char **  layerNames,
WeightsRole roles 
)
pure virtual

Get description of all weights that could be refit.

Parameters
sizeThe number of items that can be safely written to a non-null layerNames or roles.
layerNamesWhere to write the layer names.
rolesWhere to write the weights roles.
Returns
The number of Weights that could be refit.

If layerNames!=nullptr, each written pointer points to a string owned by the engine being refitted, and becomes invalid when the engine is destroyed.

Here is the caller graph for this function:

◆ destroy()

virtual void nvinfer1::IRefitter::destroy ( )
pure virtual

◆ setDynamicRange()

virtual bool nvinfer1::IRefitter::setDynamicRange ( const char *  tensorName,
float  min,
float  max 
)
pure virtual

Update dynamic range for a tensor.

Parameters
tensorNameThe name of an ITensor in the network.
minThe minimum of the dynamic range for the tensor.
maxThe maximum of the dynamic range for the tensor.
Returns
True if successful; false otherwise.

Returns false if there is no Int8 engine tensor derived from a network tensor of that name. If successful, then getMissing may report that some weights need to be supplied.

◆ getDynamicRangeMin()

virtual float nvinfer1::IRefitter::getDynamicRangeMin ( const char *  tensorName) const
pure virtual

Get minimum of dynamic range.

Returns
Minimum of dynamic range.

If the dynamic range was never set, returns the minimum computed during calibration.

◆ getDynamicRangeMax()

virtual float nvinfer1::IRefitter::getDynamicRangeMax ( const char *  tensorName) const
pure virtual

Get maximum of dynamic range.

Returns
Maximum of dynamic range.

If the dynamic range was never set, returns the maximum computed during calibration.

◆ getTensorsWithDynamicRange()

virtual int32_t nvinfer1::IRefitter::getTensorsWithDynamicRange ( int32_t  size,
const char **  tensorNames 
) const
pure virtual

Get names of all tensors that have refittable dynamic ranges.

Parameters
sizeThe number of items that can be safely written to a non-null tensorNames.
tensorNamesWhere to write the layer names.
Returns
The number of Weights that could be refit.

If tensorNames!=nullptr, each written pointer points to a string owned by the engine being refitted, and becomes invalid when the engine is destroyed.

◆ setErrorRecorder()

virtual void nvinfer1::IRefitter::setErrorRecorder ( IErrorRecorder recorder)
pure virtual

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

◆ getErrorRecorder()

virtual IErrorRecorder* nvinfer1::IRefitter::getErrorRecorder ( ) const
pure virtual

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

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