Skip to main content

ILoop

Struct ILoop 

Source
pub struct ILoop { /* private fields */ }
Expand description

! ! \class ILoop ! ! \brief 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. ! ! The subgraph may directly use tensors defined outside of the ILoop.

Implementations§

Source§

impl ILoop

Source

pub fn addRecurrence( self: Pin<&mut ILoop>, initialValue: Pin<&mut ITensor>, ) -> *mut IRecurrenceLayer

! ! \brief 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. !

Source

pub fn addTripLimit( self: Pin<&mut ILoop>, tensor: Pin<&mut ITensor>, limit: TripLimit, ) -> *mut ITripLimitLayer

! ! \brief 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. !

Source

pub fn addIterator( self: Pin<&mut ILoop>, tensor: Pin<&mut ITensor>, axis: i32, reverse: bool, ) -> *mut IIteratorLayer

! ! \brief 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. !

Source

pub fn addLoopOutput( self: Pin<&mut ILoop>, tensor: Pin<&mut ITensor>, outputKind: LoopOutput, axis: i32, ) -> *mut ILoopOutputLayer

! ! \brief 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. !

Source

pub unsafe fn setName(self: Pin<&mut ILoop>, name: *const c_char)

! ! \brief 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 getName() !

Source

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

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

Trait Implementations§

Source§

impl ExternType for ILoop

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, L, o, o, p)

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

type Kind = Opaque

Source§

impl MakeCppStorage for ILoop

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut ILoop

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 ILoop)

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

Auto Trait Implementations§

§

impl !Freeze for ILoop

§

impl !RefUnwindSafe for ILoop

§

impl !Send for ILoop

§

impl !Sync for ILoop

§

impl !Unpin for ILoop

§

impl UnwindSafe for ILoop

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.