TensorRT  5.1.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
nvinfer1::IRefitter Class Referenceabstract

Updates weights in an engine. More...

#include <NvInfer.h>

Public Member Functions

virtual bool setWeights (const char *layerName, WeightsRole role, Weights weights)=0
 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: More...
 
virtual bool refitCudaEngine ()=0
 Updates associated engine. Return true if successful. More...
 
virtual int getMissing (int size, const char **layerNames, WeightsRole *roles)=0
 Get description of missing weights. More...
 
virtual int getAll (int size, const char **layerNames, WeightsRole *roles)=0
 Get description of all weights that could be refit. More...
 
virtual void destroy ()=0
 

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.

Member Function Documentation

virtual int nvinfer1::IRefitter::getAll ( int  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.

virtual int nvinfer1::IRefitter::getMissing ( int  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.

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

Updates associated engine. Return true if successful.

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

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.


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