TensorRT 8.4.0
nvinfer1::IIfConditional Class Reference

#include <NvInfer.h>

Inheritance diagram for nvinfer1::IIfConditional:
nvinfer1::INoCopy

Public Member Functions

IConditionLayersetCondition (ITensor &condition) noexcept
 Set the condition tensor for this If-Conditional construct. More...
 
IIfConditionalOutputLayeraddOutput (ITensor &trueSubgraphOutput, ITensor &falseSubgraphOutput) noexcept
 Add an If-conditional output. More...
 
IIfConditionalInputLayeraddInput (ITensor &input) noexcept
 Add an If-conditional input. More...
 
void setName (const char *name) noexcept
 Set the name of the conditional. More...
 
const char * getName () const noexcept
 Return the name of the conditional. More...
 

Protected Member Functions

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

Protected Attributes

apiv::VIfConditional * mImpl
 

Detailed Description

Helper for constructing conditionally-executed subgraphs.

An If-conditional conditionally executes part of the network according to the following pseudo-code:

If condition is true then: output = trueSubgraph(trueInputs); Else output = falseSubgraph(falseInputs); Emit output

Condition is a 0D boolean tensor (representing a scalar). trueSubgraph represents a network subgraph that is executed when condition is evaluated to True. falseSubgraph represents a network subgraph that is executed when condition is evaluated to False.

The following constraints apply to If-conditionals:

  • Both the trueSubgraph and falseSubgraph must be defined.
  • The number of output tensors in both subgraphs is the same.
  • The type and shape of each output tensor from true/false subgraphs are the same.

Constructor & Destructor Documentation

◆ ~IIfConditional()

virtual nvinfer1::IIfConditional::~IIfConditional ( )
protectedvirtualdefaultnoexcept

Member Function Documentation

◆ addInput()

IIfConditionalInputLayer * nvinfer1::IIfConditional::addInput ( ITensor input)
inlinenoexcept

Add an If-conditional input.

Parameters
inputAn input to the conditional that can be used by either or both of the conditional’s subgraphs.
See also
IIfConditionalInputLayer

◆ addOutput()

IIfConditionalOutputLayer * nvinfer1::IIfConditional::addOutput ( ITensor trueSubgraphOutput,
ITensor falseSubgraphOutput 
)
inlinenoexcept

Add an If-conditional output.

Parameters
trueSubgraphOutputThe output of the subgraph executed when the conditional evaluates to true.
falseSubgraphOutputThe output of the subgraph executed when the conditional evaluates to false.

Each output layer of an IIfConditional represents a single output of either the true-subgraph or the false-subgraph of an IIfConditional, depending on which subgraph was executed.

See also
IIfConditionalOutputLayer

◆ getName()

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

Return the name of the conditional.

See also
setName()

◆ setCondition()

IConditionLayer * nvinfer1::IIfConditional::setCondition ( ITensor condition)
inlinenoexcept

Set the condition tensor for this If-Conditional construct.

Parameters
conditionThe condition tensor that will determine which subgraph to execute.

condition tensor must be a 0D execution tensor (scalar) with type DataType::kBOOL.

See also
IConditionLayer

◆ setName()

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

Set the name of the conditional.

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

See also
getName()

Member Data Documentation

◆ mImpl

apiv::VIfConditional* nvinfer1::IIfConditional::mImpl
protected

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