TensorRT 10.5.0
nvinfer1::ILoop Class Reference

Helper for creating a recurrent subgraph. More...

#include <NvInfer.h>

Inheritance diagram for nvinfer1::ILoop:
nvinfer1::INoCopy

Public Member Functions

IRecurrenceLayeraddRecurrence (ITensor &initialValue) noexcept
 Create a recurrence layer for this loop with initialValue as its first input. More...
 
ITripLimitLayeraddTripLimit (ITensor &tensor, TripLimit limit) noexcept
 Add a trip-count limiter, based on the given tensor. More...
 
IIteratorLayeraddIterator (ITensor &tensor, int32_t axis=0, bool reverse=false) noexcept
 Return layer that subscripts tensor by loop iteration. More...
 
ILoopOutputLayeraddLoopOutput (ITensor &tensor, LoopOutput outputKind, int32_t axis=0) noexcept
 Make an output for this loop, based on the given tensor. More...
 
void setName (char const *name) noexcept
 Set the name of the loop. More...
 
char const * getName () const noexcept
 Return the name of the loop. More...
 

Protected Member Functions

virtual ~ILoop () noexcept=default
 
- Protected Member Functions inherited from nvinfer1::INoCopy
 INoCopy ()=default
 
virtual ~INoCopy ()=default
 
 INoCopy (INoCopy const &other)=delete
 
INoCopyoperator= (INoCopy const &other)=delete
 
 INoCopy (INoCopy &&other)=delete
 
INoCopyoperator= (INoCopy &&other)=delete
 

Protected Attributes

apiv::VLoop * mImpl
 

Detailed Description

Helper for creating a recurrent subgraph.

An ILoop defines a loop within a network. It supports the implementation of recurrences, which are crucial for iterative computations, such as RNNs for natural language processing and time-series analysis.

Constructor & Destructor Documentation

◆ ~ILoop()

virtual nvinfer1::ILoop::~ILoop ( )
protectedvirtualdefaultnoexcept

Member Function Documentation

◆ addIterator()

IIteratorLayer * nvinfer1::ILoop::addIterator ( ITensor tensor,
int32_t  axis = 0,
bool  reverse = false 
)
inlinenoexcept

Return layer that subscripts tensor by loop iteration.

For reverse=false, this is equivalent to addGather(tensor, I, 0) where I is a scalar tensor containing the loop iteration number. For reverse=true, this is equivalent to addGather(tensor, M-1-I, 0) where M is the trip count computed from TripLimits of kind kCOUNT.

◆ addLoopOutput()

ILoopOutputLayer * nvinfer1::ILoop::addLoopOutput ( ITensor tensor,
LoopOutput  outputKind,
int32_t  axis = 0 
)
inlinenoexcept

Make an output for this loop, based on the given tensor.

axis is the axis for concatenation (if using outputKind of kCONCATENATE or kREVERSE).

If outputKind is kCONCATENATE or kREVERSE, a second input specifying the concatenation dimension must be added via method ILoopOutputLayer::setInput.

◆ addRecurrence()

IRecurrenceLayer * nvinfer1::ILoop::addRecurrence ( ITensor initialValue)
inlinenoexcept

Create a recurrence layer for this loop with initialValue as its first input.

IRecurrenceLayer requires exactly two inputs. The 2nd input must be added, via method IRecurrenceLayer::setInput(1,...) before an Engine can be built.

◆ addTripLimit()

ITripLimitLayer * nvinfer1::ILoop::addTripLimit ( ITensor tensor,
TripLimit  limit 
)
inlinenoexcept

Add a trip-count limiter, based on the given tensor.

There may be at most one kCOUNT and one kWHILE limiter for a loop. When both trip limits exist, the loop exits when the count is reached or condition is falsified. It is an error to not add at least one trip limiter.

For kCOUNT, the input tensor must be available before the loop starts.

For kWHILE, the input tensor must be the output of a subgraph that contains only layers that are not ITripLimitLayer, IIteratorLayer or ILoopOutputLayer. Any IRecurrenceLayers in the subgraph must belong to the same loop as the ITripLimitLayer. A trivial example of this rule is that the input to the kWHILE is the output of an IRecurrenceLayer for the same loop.

◆ getName()

char const * nvinfer1::ILoop::getName ( ) const
inlinenoexcept

Return the name of the loop.

See also
setName()

◆ setName()

void nvinfer1::ILoop::setName ( char const *  name)
inlinenoexcept

Set the name of the loop.

The name is used in error diagnostics. This method copies the name string.

Warning
The string name must be null-terminated, and be at most 4096 bytes including the terminator.
See also
getName()

Member Data Documentation

◆ mImpl

apiv::VLoop* nvinfer1::ILoop::mImpl
protected

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

  Copyright © 2024 NVIDIA Corporation
  Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact