Skip to main content

ILayer

Struct ILayer 

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

ILayer

Base class for all layer classes in a network definition.

Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.

Implementations§

Source§

impl ILayer

Source

pub fn getType(self: &ILayer) -> LayerType

Return the type of a layer.

See LayerType

Source

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

Set the name of a layer.

This method copies the name string.

The string name must be null-terminated, and be at most 4096 bytes including the terminator.

See [getName()]

Source

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

Return the name of a layer.

See [setName()]

Source

pub fn getNbInputs(self: &ILayer) -> i32

Get the number of inputs of a layer.

Source

pub fn getInput(self: &ILayer, index: i32) -> *mut ITensor

Get the layer input corresponding to the given index.

  • index The index of the input tensor.

The input tensor, or nullptr if the index is out of range or the tensor is optional ( ISliceLayer).

Source

pub fn getNbOutputs(self: &ILayer) -> i32

Get the number of outputs of a layer.

Source

pub fn getOutput(self: &ILayer, index: i32) -> *mut ITensor

Get the layer output corresponding to the given index.

The indexed output tensor, or nullptr if the index is out of range or the tensor is optional.

Source

pub fn setInput(self: Pin<&mut ILayer>, index: i32, tensor: Pin<&mut ITensor>)

Replace an input of this layer with a specific tensor.

  • index the index of the input to modify.
  • tensor the new input tensor

Except for IFillLayer, ILoopOutputLayer, INMSLayer, IResizeLayer, IShuffleLayer, and ISliceLayer, this method cannot change the number of inputs to a layer. The index argument must be less than the value of getNbInputs().

See comments for overloads of setInput() for layers with special behavior.

Source

pub fn getOutputType(self: &ILayer, index: i32) -> DataType

get the output type of this layer

  • index the index of the output

the inferred output type.

See [getOutputType()] outputTypeIsSet() resetOutputType()

Source

pub unsafe fn setMetadata(self: Pin<&mut ILayer>, metadata: *const c_char)

Set the metadata for this layer.

The metadata is emitted in the JSON returned by IEngineInspector with ProfilingVerbosity set to kDETAILED.

  • metadata The per-layer metadata.

The string name must be null-terminated and be at most 4096 bytes including the terminator.

See [getMetadata()] See [getLayerInformation()]

Source

pub fn getMetadata(self: &ILayer) -> *const c_char

Get the metadata of the layer.

The metadata as a null-terminated C-style string. If setMetadata() has not been called, an empty string “” will be returned as a default value.

See [setMetadata()]

Source

pub fn setNbRanks(self: Pin<&mut ILayer>, nbRanks: i32) -> bool

Set the number of ranks for multi-device execution.

Setting nbRanks > 1 is only allowed for specific layer types that support multi-device execution:

  • IDistCollectiveLayer: Determines output shape for kALL_GATHER and kREDUCE_SCATTER operations.

For attention layers, use IAttention::setNbRanks() instead. For all other layer types, nbRanks must be 1.

  • nbRanks The number of ranks for multi-device execution. Must be >= 1.

true if successful, false if the layer type does not support the specified nbRanks value.

See [getNbRanks()] See IAttention::setNbRanks()

Source

pub fn getNbRanks(self: &ILayer) -> i32

Get the number of ranks for multi-device execution.

The number of ranks configured for multi-device execution. Default is 1.

See [setNbRanks()]

Trait Implementations§

Source§

impl AsLayer for ILayer

Source§

fn as_layer(&self) -> &ILayer

Source§

fn as_layer_pin_mut(&mut self) -> Pin<&mut ILayer>

Source§

impl AsRef<ILayer> for IConvolutionLayer

Source§

fn as_ref(self: &IConvolutionLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IActivationLayer

Source§

fn as_ref(self: &IActivationLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IPoolingLayer

Source§

fn as_ref(self: &IPoolingLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ILRNLayer

Source§

fn as_ref(self: &ILRNLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IScaleLayer

Source§

fn as_ref(self: &IScaleLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ISoftMaxLayer

Source§

fn as_ref(self: &ISoftMaxLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IConcatenationLayer

Source§

fn as_ref(self: &IConcatenationLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IDeconvolutionLayer

Source§

fn as_ref(self: &IDeconvolutionLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IElementWiseLayer

Source§

fn as_ref(self: &IElementWiseLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IGatherLayer

Source§

fn as_ref(self: &IGatherLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IUnaryLayer

Source§

fn as_ref(self: &IUnaryLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IReduceLayer

Source§

fn as_ref(self: &IReduceLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IPaddingLayer

Source§

fn as_ref(self: &IPaddingLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IShuffleLayer

Source§

fn as_ref(self: &IShuffleLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ISliceLayer

Source§

fn as_ref(self: &ISliceLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IShapeLayer

Source§

fn as_ref(self: &IShapeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ITopKLayer

Source§

fn as_ref(self: &ITopKLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IMatrixMultiplyLayer

Source§

fn as_ref(self: &IMatrixMultiplyLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for INonZeroLayer

Source§

fn as_ref(self: &INonZeroLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IRaggedSoftMaxLayer

Source§

fn as_ref(self: &IRaggedSoftMaxLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IIdentityLayer

Source§

fn as_ref(self: &IIdentityLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ICastLayer

Source§

fn as_ref(self: &ICastLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IConstantLayer

Source§

fn as_ref(self: &IConstantLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IParametricReLULayer

Source§

fn as_ref(self: &IParametricReLULayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IResizeLayer

Source§

fn as_ref(self: &IResizeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ILoopBoundaryLayer

Source§

fn as_ref(self: &ILoopBoundaryLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ISelectLayer

Source§

fn as_ref(self: &ISelectLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IAssertionLayer

Source§

fn as_ref(self: &IAssertionLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IFillLayer

Source§

fn as_ref(self: &IFillLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IQuantizeLayer

Source§

fn as_ref(self: &IQuantizeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IDequantizeLayer

Source§

fn as_ref(self: &IDequantizeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IDynamicQuantizeLayer

Source§

fn as_ref(self: &IDynamicQuantizeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IEinsumLayer

Source§

fn as_ref(self: &IEinsumLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IScatterLayer

Source§

fn as_ref(self: &IScatterLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IOneHotLayer

Source§

fn as_ref(self: &IOneHotLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IGridSampleLayer

Source§

fn as_ref(self: &IGridSampleLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for INMSLayer

Source§

fn as_ref(self: &INMSLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IReverseSequenceLayer

Source§

fn as_ref(self: &IReverseSequenceLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for INormalizationLayer

Source§

fn as_ref(self: &INormalizationLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ISqueezeLayer

Source§

fn as_ref(self: &ISqueezeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IUnsqueezeLayer

Source§

fn as_ref(self: &IUnsqueezeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for ICumulativeLayer

Source§

fn as_ref(self: &ICumulativeLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IAttentionBoundaryLayer

Source§

fn as_ref(self: &IAttentionBoundaryLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IRotaryEmbeddingLayer

Source§

fn as_ref(self: &IRotaryEmbeddingLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IKVCacheUpdateLayer

Source§

fn as_ref(self: &IKVCacheUpdateLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IMoELayer

Source§

fn as_ref(self: &IMoELayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ILayer> for IDistCollectiveLayer

Source§

fn as_ref(self: &IDistCollectiveLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl ExternType for ILayer

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, L, a, y, e, r)

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

type Kind = Opaque

Source§

impl MakeCppStorage for ILayer

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut ILayer

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

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

Auto Trait Implementations§

§

impl !Freeze for ILayer

§

impl !RefUnwindSafe for ILayer

§

impl !Send for ILayer

§

impl !Sync for ILayer

§

impl Unpin for ILayer

§

impl UnsafeUnpin for ILayer

§

impl UnwindSafe for ILayer

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.