Skip to main content

IFillLayer

Struct IFillLayer 

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

IFillLayer

Generate a tensor according to a specified mode.

The fill layer generates a tensor with values that are drawn from a random distribution or an affine function of their indices, as specified by the FillMode.

When an IFillLayer is initially added to a network, all of its parameters are static. Each parameter may be changed to dynamic by setting a corresponding input. A parameter is considered dynamic even if that input is the output of an IConstantLayer. The inputs for each parameter are:

  • 0: Dimensions
  • 1: Alpha
  • 2: Beta

The parameter Dimensions describes the shape of the output. If the Dimensions input is provided, it must be a 1D tensor of type Int32 or Int64 whose length is computable by constant folding.

The meanings of Alpha and Beta depend on the mode, as described in IFillLayer::setAlpha(), IFillLayer::setBeta(), and IFillLayer::setInput(). Parameters Alpha and Beta must both be static or both be dynamic.

An IFillLayer can produce a shape tensor if the following restrictions are met:

  • The FillOperation is kLINSPACE.
  • The output has type Int32, Int64, or Float.
  • The volume of the output is within the volume limit imposed on shape tensors.
  • If input 0 exists, the values of input 0 must be computable by constant folding.

See FillOperation

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

Implementations§

Source§

impl IFillLayer

Source

pub fn setDimensions(self: Pin<&mut IFillLayer>, dimensions: &Dims64)

Set the output tensor’s dimensions.

  • dimensions The output tensor’s dimensions.

If the first input had been used to create this layer, that input is reset to null by this method.

See [getDimensions]

Source

pub fn getDimensions(self: &IFillLayer) -> Dims64

Get the output tensor’s dimensions.

The output tensor’s dimensions, or an invalid Dims structure.

If the first input is present and non-null, this function returns a Dims with nbDims = -1.

See [setDimensions]

Source

pub fn setOperation(self: Pin<&mut IFillLayer>, op: FillOperation)

Set the fill operation for the layer.

See [getOperation()], FillOperation

Source

pub fn getOperation(self: &IFillLayer) -> FillOperation

Get the fill operation for the layer.

See [setOperation()], FillOperation

Source

pub fn setAlpha(self: Pin<&mut IFillLayer>, alpha: f64)

Set the alpha parameter.

  • alpha has different meanings for each operator:

Operation | Usage kLINSPACE | the start value, defaults to 0.0; kRANDOM_UNIFORM | the minimum value, defaults to 0.0; kRANDOM_NORMAL | the mean of the normal distribution, default is 0.0;

If input 1 exists, it is reset to null by this method.

See [getAlpha], setAlphaInt64

Source

pub fn getAlpha(self: &IFillLayer) -> f64

Get the value of alpha parameter.

A double value of alpha.

If the second input is present and non-null, this function returns -1.0.

See [setAlpha]

Source

pub fn setBeta(self: Pin<&mut IFillLayer>, beta: f64)

Set the beta parameter.

  • beta has different meanings for each operator:

Operation | Usage kLINSPACE | the delta value, defaults to 1.0; kRANDOM_UNIFORM | the maximal value, defaults to 1.0; kRANDOM_NORMAL | the standard deviation of the normal distribution, default is 1.0;

If input 2 exists, it is reset to null by this method.

See [getBeta]

Source

pub fn getBeta(self: &IFillLayer) -> f64

Get the value of beta parameter.

A double value of beta.

If the third input is present and non-null, this function returns -1.0.

See [setBeta], setBetaInt64

Source

pub fn setAlphaInt64(self: Pin<&mut IFillLayer>, alpha: i64)

Set the alpha parameter with int64 datatype.

  • alpha has different meanings for each operator:

Operation | Usage kLINSPACE | the start value, defaults to 0; kRANDOM_UNIFORM | the minimum value, defaults to 0; kRANDOM_NORMAL | the mean of the normal distribution, default is 0;

If a third input had been used to create this layer, that input is reset to null by this method.

See [getAlphaInt64]

Source

pub fn getAlphaInt64(self: &IFillLayer) -> i64

Get the value of alpha parameter with int64 datatype.

A int64 value of alpha.

If the second input is present and non-null, this function returns -1.

See [setAlphaInt64]

Source

pub fn setBetaInt64(self: Pin<&mut IFillLayer>, beta: i64)

Set the beta parameter with int64 datatype.

  • beta has different meanings for each operator:

Operation | Usage kLINSPACE | the delta value, defaults to 1; kRANDOM_UNIFORM | the maximal value, defaults to 1; kRANDOM_NORMAL | the standard deviation of the normal distribution, default is 1;

If a third input had been used to create this layer, that input is reset to null by this method.

See [getBetaInt64]

Source

pub fn getBetaInt64(self: &IFillLayer) -> i64

Get the value of beta parameter with int64 datatype.

A int64 value of beta.

If the third input is present and non-null, this function returns -1.0.

See [setBetaInt64]

Source

pub fn isAlphaBetaInt64(self: &IFillLayer) -> bool

Return true if alpha/beta have type int64, false if they have type double.

Source

pub fn setToType(self: Pin<&mut IFillLayer>, toType: DataType)

Set the fill layer output type.

  • toType The DataType of the output tensor.

Set the output type of the fill layer. Valid values are DataType::kFLOAT, DataType::kHALF, DataType::kINT32, and DataType::kINT64. If the network is strongly typed, setToType must be used to set the output type, and use of setOutputType is an error. Otherwise, types passed to setOutputType and setToType must be the same.

See NetworkDefinitionCreationFlag::kSTRONGLY_TYPED

See FillOperation for more information on which types are supported for each mode.

Source

pub fn getToType(self: &IFillLayer) -> DataType

Get the fill layer output type.

toType parameter set during layer creation or by setToType(). The return value is the output type of the fill layer. The default value is DataType::kFLOAT.

Trait Implementations§

Source§

impl AsLayer for IFillLayer

Source§

fn as_layer(&self) -> &ILayer

Source§

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

Source§

impl AsLayerTyped for IFillLayer

Source§

const TYPE: LayerType = LayerType::kFILL

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 ExternType for IFillLayer

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, F, i, l, l, 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 IFillLayer

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut IFillLayer

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

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.