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
impl IFillLayer
Sourcepub fn setDimensions(self: Pin<&mut IFillLayer>, dimensions: &Dims64)
pub fn setDimensions(self: Pin<&mut IFillLayer>, dimensions: &Dims64)
Set the output tensor’s dimensions.
dimensionsThe 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]
Sourcepub fn getDimensions(self: &IFillLayer) -> Dims64
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]
Sourcepub fn setOperation(self: Pin<&mut IFillLayer>, op: FillOperation)
pub fn setOperation(self: Pin<&mut IFillLayer>, op: FillOperation)
Set the fill operation for the layer.
See [getOperation()], FillOperation
Sourcepub fn getOperation(self: &IFillLayer) -> FillOperation
pub fn getOperation(self: &IFillLayer) -> FillOperation
Get the fill operation for the layer.
See [setOperation()], FillOperation
Sourcepub fn setAlpha(self: Pin<&mut IFillLayer>, alpha: f64)
pub fn setAlpha(self: Pin<&mut IFillLayer>, alpha: f64)
Set the alpha parameter.
alphahas 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
Sourcepub fn getAlpha(self: &IFillLayer) -> f64
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]
Sourcepub fn setBeta(self: Pin<&mut IFillLayer>, beta: f64)
pub fn setBeta(self: Pin<&mut IFillLayer>, beta: f64)
Set the beta parameter.
betahas 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]
Sourcepub fn getBeta(self: &IFillLayer) -> f64
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
Sourcepub fn setAlphaInt64(self: Pin<&mut IFillLayer>, alpha: i64)
pub fn setAlphaInt64(self: Pin<&mut IFillLayer>, alpha: i64)
Set the alpha parameter with int64 datatype.
alphahas 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]
Sourcepub fn getAlphaInt64(self: &IFillLayer) -> i64
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]
Sourcepub fn setBetaInt64(self: Pin<&mut IFillLayer>, beta: i64)
pub fn setBetaInt64(self: Pin<&mut IFillLayer>, beta: i64)
Set the beta parameter with int64 datatype.
betahas 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]
Sourcepub fn getBetaInt64(self: &IFillLayer) -> i64
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]
Sourcepub fn isAlphaBetaInt64(self: &IFillLayer) -> bool
pub fn isAlphaBetaInt64(self: &IFillLayer) -> bool
Return true if alpha/beta have type int64, false if they have type double.
Sourcepub fn setToType(self: Pin<&mut IFillLayer>, toType: DataType)
pub fn setToType(self: Pin<&mut IFillLayer>, toType: DataType)
Set the fill layer output type.
toTypeThe 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.
Sourcepub fn getToType(self: &IFillLayer) -> DataType
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.