Skip to main content

IIfConditional

Struct IIfConditional 

Source
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

Source

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 !

Source

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 !

Source

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 !

Source

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() !

Source

pub fn getName(self: &IIfConditional) -> *const c_char

! ! \brief Return the name of the conditional. ! ! \see setName() !

Trait Implementations§

Source§

impl ExternType for IIfConditional

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, I, f, C, o, n, d, i, t, i, o, n, a, l)

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

type Kind = Opaque

Source§

impl MakeCppStorage for IIfConditional

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut IIfConditional

Allocates heap space for this type in C++ and return a pointer to that space, but do not initialize that space (i.e. do not yet call a constructor). Read more
Source§

unsafe fn free_uninitialized_cpp_storage(arg0: *mut IIfConditional)

Frees a C++ allocation which has not yet had a constructor called. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.