TensorRT  7.0.0.11
nvinfer1::IRNNv2Layer Class Referenceabstract

An RNN layer in a network definition, version 2. More...

#include <NvInfer.h>

Inheritance diagram for nvinfer1::IRNNv2Layer:
nvinfer1::ILayer

Public Member Functions

virtual int32_t getLayerCount () const =0
 
virtual int32_t getHiddenSize () const =0
 
virtual int32_t getMaxSeqLength () const =0
 
virtual int32_t getDataLength () const =0
 
virtual void setSequenceLengths (ITensor &seqLengths)=0
 Specify individual sequence lengths in the batch with the ITensor pointed to by seqLengths. More...
 
virtual ITensorgetSequenceLengths () const =0
 Get the sequence lengths specified for the RNN. More...
 
virtual void setOperation (RNNOperation op)=0
 Set the operation of the RNN layer. More...
 
virtual RNNOperation getOperation () const =0
 Get the operation of the RNN layer. More...
 
virtual void setInputMode (RNNInputMode op)=0
 Set the input mode of the RNN layer. More...
 
virtual RNNInputMode getInputMode () const =0
 Get the input mode of the RNN layer. More...
 
virtual void setDirection (RNNDirection op)=0
 Set the direction of the RNN layer. More...
 
virtual RNNDirection getDirection () const =0
 Get the direction of the RNN layer. More...
 
virtual void setWeightsForGate (int layerIndex, RNNGateType gate, bool isW, Weights weights)=0
 Set the weight parameters for an individual gate in the RNN. More...
 
virtual Weights getWeightsForGate (int layerIndex, RNNGateType gate, bool isW) const =0
 Get the weight parameters for an individual gate in the RNN. More...
 
virtual void setBiasForGate (int layerIndex, RNNGateType gate, bool isW, Weights bias)=0
 Set the bias parameters for an individual gate in the RNN. More...
 
virtual Weights getBiasForGate (int layerIndex, RNNGateType gate, bool isW) const =0
 Get the bias parameters for an individual gate in the RNN. More...
 
virtual void setHiddenState (ITensor &hidden)=0
 Set the initial hidden state of the RNN with the provided hidden ITensor. More...
 
virtual ITensorgetHiddenState () const =0
 Get the initial hidden state of the RNN. More...
 
virtual void setCellState (ITensor &cell)=0
 Set the initial cell state of the LSTM with the provided cell ITensor. More...
 
virtual ITensorgetCellState () const =0
 Get the initial cell state of the RNN. More...
 
- Public Member Functions inherited from nvinfer1::ILayer
virtual LayerType getType () const =0
 Return the type of a layer. More...
 
virtual void setName (const char *name)=0
 Set the name of a layer. More...
 
virtual const char * getName () const =0
 Return the name of a layer. More...
 
virtual int getNbInputs () const =0
 Get the number of inputs of a layer.
 
virtual ITensorgetInput (int index) const =0
 Get the layer input corresponding to the given index. More...
 
virtual int getNbOutputs () const =0
 Get the number of outputs of a layer.
 
virtual ITensorgetOutput (int index) const =0
 Get the layer output corresponding to the given index. More...
 
virtual void setInput (int index, ITensor &tensor)=0
 Replace an input of this layer with a specific tensor. More...
 
virtual void setPrecision (DataType dataType)=0
 Set the computational precision of this layer. More...
 
virtual DataType getPrecision () const =0
 get the computational precision of this layer More...
 
virtual bool precisionIsSet () const =0
 whether the computational precision has been set for this layer More...
 
virtual void resetPrecision ()=0
 reset the computational precision for this layer More...
 
virtual void setOutputType (int index, DataType dataType)=0
 Set the output type of this layer. More...
 
virtual DataType getOutputType (int index) const =0
 get the output type of this layer More...
 
virtual bool outputTypeIsSet (int index) const =0
 whether the output type has been set for this layer More...
 
virtual void resetOutputType (int index)=0
 reset the output type for this layer More...
 

Detailed Description

An RNN layer in a network definition, version 2.

This layer supersedes IRNNLayer.

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

Member Function Documentation

virtual Weights nvinfer1::IRNNv2Layer::getBiasForGate ( int  layerIndex,
RNNGateType  gate,
bool  isW 
) const
pure virtual

Get the bias parameters for an individual gate in the RNN.

See also
setBiasForGate()
virtual ITensor* nvinfer1::IRNNv2Layer::getCellState ( ) const
pure virtual

Get the initial cell state of the RNN.

See also
setCellState()
virtual RNNDirection nvinfer1::IRNNv2Layer::getDirection ( ) const
pure virtual

Get the direction of the RNN layer.

See also
setDirection(), RNNDirection
virtual ITensor* nvinfer1::IRNNv2Layer::getHiddenState ( ) const
pure virtual

Get the initial hidden state of the RNN.

See also
setHiddenState()
virtual RNNInputMode nvinfer1::IRNNv2Layer::getInputMode ( ) const
pure virtual

Get the input mode of the RNN layer.

See also
setInputMode(), RNNInputMode
virtual RNNOperation nvinfer1::IRNNv2Layer::getOperation ( ) const
pure virtual

Get the operation of the RNN layer.

See also
setOperation(), RNNOperation
virtual ITensor* nvinfer1::IRNNv2Layer::getSequenceLengths ( ) const
pure virtual

Get the sequence lengths specified for the RNN.

Returns
nullptr if no sequence lengths were specified, the sequence length data otherwise.
See also
setSequenceLengths()
virtual Weights nvinfer1::IRNNv2Layer::getWeightsForGate ( int  layerIndex,
RNNGateType  gate,
bool  isW 
) const
pure virtual

Get the weight parameters for an individual gate in the RNN.

See also
setWeightsForGate()
virtual void nvinfer1::IRNNv2Layer::setBiasForGate ( int  layerIndex,
RNNGateType  gate,
bool  isW,
Weights  bias 
)
pure virtual

Set the bias parameters for an individual gate in the RNN.

Parameters
layerIndexThe index of the layer that contains this gate. See the section Order of weight matrices in IRNNLayer::setWeights() for a description of the layer index.
gateThe name of the gate within the RNN layer. The gate name must correspond to one of the gates used by this layer's RNNOperation.
isWTrue if the bias parameters are for the input bias Wb[g] and false if they are for the recurrent input bias Rb[g]. See RNNOperation for equations showing how these bias vectors are used in the RNN gate.
biasThe weight structure holding the bias parameters, which should be an array of size getHiddenSize().
virtual void nvinfer1::IRNNv2Layer::setCellState ( ITensor cell)
pure virtual

Set the initial cell state of the LSTM with the provided cell ITensor.

The cell ITensor should have the dimensions {N1, ..., Np, L, H}, where:

  • N1..Np are the index dimensions specified by the input tensor
  • L is the number of layers in the RNN, equal to getLayerCount() if getDirection is kUNIDIRECTION, and 2x getLayerCount() if getDirection is kBIDIRECTION. In the bi-directional case, layer l's final forward hidden state is stored in L = 2*l, and final backward hidden state is stored in L= 2*l + 1.
  • H is the hidden state for each layer, equal to getHiddenSize().

It is an error to call setCellState() on an RNN layer that is not configured with RNNOperation::kLSTM.

virtual void nvinfer1::IRNNv2Layer::setDirection ( RNNDirection  op)
pure virtual

Set the direction of the RNN layer.

See also
getDirection(), RNNDirection
virtual void nvinfer1::IRNNv2Layer::setHiddenState ( ITensor hidden)
pure virtual

Set the initial hidden state of the RNN with the provided hidden ITensor.

The hidden ITensor should have the dimensions {N1, ..., Np, L, H}, where:

  • N1..Np are the index dimensions specified by the input tensor
  • L is the number of layers in the RNN, equal to getLayerCount() if getDirection is kUNIDIRECTION, and 2x getLayerCount() if getDirection is kBIDIRECTION. In the bi-directional case, layer l's final forward hidden state is stored in L = 2*l, and final backward hidden state is stored in L= 2*l + 1.
  • H is the hidden state for each layer, equal to getHiddenSize().
virtual void nvinfer1::IRNNv2Layer::setInputMode ( RNNInputMode  op)
pure virtual

Set the input mode of the RNN layer.

See also
getInputMode(), RNNInputMode
virtual void nvinfer1::IRNNv2Layer::setOperation ( RNNOperation  op)
pure virtual

Set the operation of the RNN layer.

See also
getOperation(), RNNOperation
virtual void nvinfer1::IRNNv2Layer::setSequenceLengths ( ITensor seqLengths)
pure virtual

Specify individual sequence lengths in the batch with the ITensor pointed to by seqLengths.

The seqLengths ITensor should be a {N1, ..., Np} tensor, where N1..Np are the index dimensions of the input tensor to the RNN.

If this is not specified, then the RNN layer assumes all sequences are size getMaxSeqLength().

All sequence lengths in seqLengths should be in the range [1, getMaxSeqLength()]. Zero-length sequences are not supported.

This tensor must be of type DataType::kINT32.

virtual void nvinfer1::IRNNv2Layer::setWeightsForGate ( int  layerIndex,
RNNGateType  gate,
bool  isW,
Weights  weights 
)
pure virtual

Set the weight parameters for an individual gate in the RNN.

Parameters
layerIndexThe index of the layer that contains this gate. See the section Order of weight matrices in IRNNLayer::setWeights() for a description of the layer index.
gateThe name of the gate within the RNN layer. The gate name must correspond to one of the gates used by this layer's RNNOperation.
isWTrue if the weight parameters are for the input matrix W[g] and false if they are for the recurrent input matrix R[g]. See RNNOperation for equations showing how these matrices are used in the RNN gate.
weightsThe weight structure holding the weight parameters, which are stored as a row-major 2D matrix. See the layout of elements within a weight matrix in IRNNLayer::setWeights() for documentation on the expected dimensions of this matrix.

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