pub struct IIfConditional { /* private fields */ }Expand description
! ! \class IIfConditional ! ! \brief 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 evaluates to True. ! falseSubgraph represents a network subgraph that is executed when condition evaluates 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. ! - Corresponding output tensors from the true/false subgraphs have the same type and rank. ! ! The subgraphs may directly use tensors defined outside of the IIfConditional.
Implementations§
Source§impl IIfConditional
impl IIfConditional
Sourcepub fn setCondition(
self: Pin<&mut IIfConditional>,
condition: Pin<&mut ITensor>,
) -> *mut IConditionLayer
pub fn setCondition( self: Pin<&mut IIfConditional>, condition: Pin<&mut ITensor>, ) -> *mut IConditionLayer
! ! \brief Set the condition tensor for this If-Conditional construct. ! ! \param condition The condition tensor that will determine which subgraph to execute. ! ! \p condition tensor must be a 0D execution tensor (scalar) with type DataType::kBOOL. ! ! \see IConditionLayer !
Sourcepub fn addOutput(
self: Pin<&mut IIfConditional>,
trueSubgraphOutput: Pin<&mut ITensor>,
falseSubgraphOutput: Pin<&mut ITensor>,
) -> *mut IIfConditionalOutputLayer
pub fn addOutput( self: Pin<&mut IIfConditional>, trueSubgraphOutput: Pin<&mut ITensor>, falseSubgraphOutput: Pin<&mut ITensor>, ) -> *mut IIfConditionalOutputLayer
! ! \brief Add an If-conditional output. ! ! \param trueSubgraphOutput The output of the subgraph executed when the conditional evaluates to true. ! \param falseSubgraphOutput The 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. ! ! The ranks of the two tensors must be equal unless the condition is a build-time constant. ! ! \see IIfConditionalOutputLayer !
Sourcepub fn addInput(
self: Pin<&mut IIfConditional>,
input: Pin<&mut ITensor>,
) -> *mut IIfConditionalInputLayer
pub fn addInput( self: Pin<&mut IIfConditional>, input: Pin<&mut ITensor>, ) -> *mut IIfConditionalInputLayer
! ! \brief Add an If-conditional input. ! ! \param input An input to the conditional that can be used by either or both of the conditional’s subgraphs. ! ! \see IIfConditionalInputLayer !
Sourcepub unsafe fn setName(self: Pin<&mut IIfConditional>, name: *const c_char)
pub unsafe fn setName(self: Pin<&mut IIfConditional>, name: *const c_char)
! ! \brief Set the name of the conditional. ! ! 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 getName() !
Sourcepub fn getName(self: &IIfConditional) -> *const c_char
pub fn getName(self: &IIfConditional) -> *const c_char
! ! \brief Return the name of the conditional. ! ! \see setName() !