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

Public Member Functions

 LReLU (float negSlope)
 
 LReLU (const void *buffer, size_t length)
 
 ~LReLU () override=default
 
int getNbOutputs () const override
 Get the number of outputs from the layer. More...
 
Dims getOutputDimensions (int index, const Dims *inputs, int nbInputDims) override
 
int initialize () override
 Initialize the layer for execution. More...
 
void terminate () override
 Release resources acquired during plugin layer initialization. More...
 
size_t getWorkspaceSize (int maxBatchSize) const override
 
int enqueue (int batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream) override
 
size_t getSerializationSize () const override
 Find the size of the serialization buffer required. More...
 
void serialize (void *buffer) const override
 Serialize the layer. More...
 
void configureWithFormat (const Dims *inputDims, int nbInputs, const Dims *outputDims, int nbOutputs, DataType type, PluginFormat format, int maxBatchSize) override
 
bool supportsFormat (DataType type, PluginFormat format) const override
 Check format support. More...
 
const char * getPluginType () const override
 Return the plugin type. More...
 
const char * getPluginVersion () const override
 Return the plugin version. More...
 
void destroy () override
 Destroy the plugin object. More...
 
IPluginV2clone () const override
 Clone the plugin object. More...
 
virtual int32_t getTensorRTVersion () const
 Return the API version with which this plugin was built. More...
 
virtual Dims getOutputDimensions (int32_t index, const Dims *inputs, int32_t nbInputDims)=0
 Get the dimension of an output tensor. More...
 
virtual void configureWithFormat (const Dims *inputDims, int32_t nbInputs, const Dims *outputDims, int32_t nbOutputs, DataType type, PluginFormat format, int32_t maxBatchSize)=0
 Configure the layer. More...
 
virtual size_t getWorkspaceSize (int32_t maxBatchSize) const =0
 Find the workspace size required by the layer. More...
 
virtual int32_t enqueue (int32_t batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream)=0
 Execute the layer. More...
 

Protected Member Functions

void setPluginNamespace (const char *libNamespace) override
 Set the namespace that this plugin object belongs to. More...
 
const char * getPluginNamespace () const override
 Return the namespace of the plugin object. More...
 

Protected Attributes

std::string mNamespace
 

Private Attributes

float mNegSlope
 
int mBatchDim
 

Constructor & Destructor Documentation

◆ LReLU() [1/2]

LReLU::LReLU ( float  negSlope)
Here is the caller graph for this function:

◆ LReLU() [2/2]

LReLU::LReLU ( const void *  buffer,
size_t  length 
)

◆ ~LReLU()

nvinfer1::plugin::LReLU::~LReLU ( )
overridedefault

Member Function Documentation

◆ getNbOutputs()

int LReLU::getNbOutputs ( ) const
overridevirtual

Get the number of outputs from the layer.

Returns
The number of outputs.

This function is called by the implementations of INetworkDefinition and IBuilder. In particular, it is called prior to any call to initialize().

Implements nvinfer1::IPluginV2.

◆ getOutputDimensions() [1/2]

Dims LReLU::getOutputDimensions ( int  index,
const Dims inputs,
int  nbInputDims 
)
override

◆ initialize()

int LReLU::initialize ( )
overridevirtual

Initialize the layer for execution.

This is called when the engine is created.

Returns
0 for success, else non-zero (which will cause engine termination).

Implements nvinfer1::IPluginV2.

◆ terminate()

void LReLU::terminate ( )
overridevirtual

Release resources acquired during plugin layer initialization.

This is called when the engine is destroyed.

See also
initialize()

Implements nvinfer1::IPluginV2.

◆ getWorkspaceSize() [1/2]

size_t LReLU::getWorkspaceSize ( int  maxBatchSize) const
override

◆ enqueue() [1/2]

int LReLU::enqueue ( int  batchSize,
const void *const *  inputs,
void **  outputs,
void *  workspace,
cudaStream_t  stream 
)
override

◆ getSerializationSize()

size_t LReLU::getSerializationSize ( ) const
overridevirtual

Find the size of the serialization buffer required.

Returns
The size of the serialization buffer.

Implements nvinfer1::IPluginV2.

Here is the caller graph for this function:

◆ serialize()

void LReLU::serialize ( void *  buffer) const
overridevirtual

Serialize the layer.

Parameters
bufferA pointer to a buffer to serialize data. Size of buffer must be equal to value returned by getSerializationSize.
See also
getSerializationSize()

Implements nvinfer1::IPluginV2.

Here is the call graph for this function:

◆ configureWithFormat() [1/2]

void LReLU::configureWithFormat ( const Dims inputDims,
int  nbInputs,
const Dims outputDims,
int  nbOutputs,
DataType  type,
PluginFormat  format,
int  maxBatchSize 
)
override

◆ supportsFormat()

bool LReLU::supportsFormat ( DataType  type,
PluginFormat  format 
) const
overridevirtual

Check format support.

Parameters
typeDataType requested.
formatPluginFormat requested.
Returns
true if the plugin supports the type-format combination.

This function is called by the implementations of INetworkDefinition, IBuilder, and safe::ICudaEngine/ICudaEngine. In particular, it is called when creating an engine and when deserializing an engine.

Warning
for the format field, the values PluginFormat::kCHW4, PluginFormat::kCHW16, and PluginFormat::kCHW32 will not be passed in, this is to keep backward compatibility with TensorRT 5.x series. Use PluginV2IOExt or PluginV2DynamicExt for other PluginFormats.
DataType:kBOOL not supported.

Implements nvinfer1::IPluginV2.

◆ getPluginType()

const char * LReLU::getPluginType ( ) const
overridevirtual

Return the plugin type.

Should match the plugin name returned by the corresponding plugin creator

See also
IPluginCreator::getPluginName()

Implements nvinfer1::IPluginV2.

◆ getPluginVersion()

const char * LReLU::getPluginVersion ( ) const
overridevirtual

Return the plugin version.

Should match the plugin version returned by the corresponding plugin creator

See also
IPluginCreator::getPluginVersion()

Implements nvinfer1::IPluginV2.

◆ destroy()

void LReLU::destroy ( )
overridevirtual

Destroy the plugin object.

This will be called when the network, builder or engine is destroyed.

Implements nvinfer1::IPluginV2.

◆ clone()

IPluginV2 * LReLU::clone ( ) const
overridevirtual

Clone the plugin object.

This copies over internal plugin parameters and returns a new plugin object with these parameters.

Implements nvinfer1::IPluginV2.

Here is the call graph for this function:

◆ setPluginNamespace()

void nvinfer1::plugin::BasePlugin::setPluginNamespace ( const char *  pluginNamespace)
inlineoverrideprotectedvirtualinherited

Set the namespace that this plugin object belongs to.

Ideally, all plugin objects from the same plugin library should have the same namespace.

Implements nvinfer1::IPluginV2.

◆ getPluginNamespace()

const char* nvinfer1::plugin::BasePlugin::getPluginNamespace ( ) const
inlineoverrideprotectedvirtualinherited

Return the namespace of the plugin object.

Implements nvinfer1::IPluginV2.

◆ getTensorRTVersion()

virtual int32_t nvinfer1::IPluginV2::getTensorRTVersion ( ) const
inlinevirtualinherited

Return the API version with which this plugin was built.

Do not override this method as it is used by the TensorRT library to maintain backwards-compatibility with plugins.

Reimplemented in nvinfer1::IPluginV2Ext, and nvinfer1::IPluginV2DynamicExt.

◆ getOutputDimensions() [2/2]

virtual Dims nvinfer1::IPluginV2::getOutputDimensions ( int32_t  index,
const Dims inputs,
int32_t  nbInputDims 
)
pure virtualinherited

Get the dimension of an output tensor.

Parameters
indexThe index of the output tensor.
inputsThe input tensors.
nbInputDimsThe number of input tensors.

This function is called by the implementations of INetworkDefinition and IBuilder. In particular, it is called prior to any call to initialize().

◆ configureWithFormat() [2/2]

virtual void nvinfer1::IPluginV2::configureWithFormat ( const Dims inputDims,
int32_t  nbInputs,
const Dims outputDims,
int32_t  nbOutputs,
DataType  type,
PluginFormat  format,
int32_t  maxBatchSize 
)
pure virtualinherited

Configure the layer.

This function is called by the builder prior to initialize(). It provides an opportunity for the layer to make algorithm choices on the basis of its weights, dimensions, and maximum batch size.

Parameters
inputDimsThe input tensor dimensions.
nbInputsThe number of inputs.
outputDimsThe output tensor dimensions.
nbOutputsThe number of outputs.
typeThe data type selected for the engine.
formatThe format selected for the engine.
maxBatchSizeThe maximum batch size.

The dimensions passed here do not include the outermost batch size (i.e. for 2-D image networks, they will be 3-dimensional CHW dimensions).

Warning
for the format field, the values PluginFormat::kCHW4, PluginFormat::kCHW16, and PluginFormat::kCHW32 will not be passed in, this is to keep backward compatibility with TensorRT 5.x series. Use PluginV2IOExt or PluginV2DynamicExt for other PluginFormats.
DataType:kBOOL not supported.

Implemented in nvinfer1::IPluginV2Ext.

◆ getWorkspaceSize() [2/2]

virtual size_t nvinfer1::IPluginV2::getWorkspaceSize ( int32_t  maxBatchSize) const
pure virtualinherited

Find the workspace size required by the layer.

This function is called during engine startup, after initialize(). The workspace size returned should be sufficient for any batch size up to the maximum.

Returns
The workspace size.

◆ enqueue() [2/2]

virtual int32_t nvinfer1::IPluginV2::enqueue ( int32_t  batchSize,
const void *const *  inputs,
void **  outputs,
void *  workspace,
cudaStream_t  stream 
)
pure virtualinherited

Execute the layer.

Parameters
batchSizeThe number of inputs in the batch.
inputsThe memory for the input tensors.
outputsThe memory for the output tensors.
workspaceWorkspace for execution.
streamThe stream in which to execute the kernels.
Returns
0 for success, else non-zero (which will cause engine termination).

Member Data Documentation

◆ mNegSlope

float nvinfer1::plugin::LReLU::mNegSlope
private

◆ mBatchDim

int nvinfer1::plugin::LReLU::mBatchDim
private

◆ mNamespace

std::string nvinfer1::plugin::BasePlugin::mNamespace
protectedinherited

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