Skip to main content

INormalizationLayer

Struct INormalizationLayer 

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

INormalizationLayer

A normalization layer in a network definition.

The normalization layer performs the following operation:

X - input Tensor Y - output Tensor S - scale Tensor B - bias Tensor

Y = (X - Mean(X, axes)) / Sqrt(Variance(X) + epsilon) * S + B

Where Mean(X, axes) is a reduction over a set of axes, and Variance(X) = Mean((X - Mean(X, axes)) ^ 2, axes).

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

Implementations§

Source§

impl INormalizationLayer

Source

pub fn setEpsilon(self: Pin<&mut INormalizationLayer>, eps: f32)

Set the epsilon value used for the normalization calculation.

The default value of eps is 1e-5F.

  • eps The epsilon value used for the normalization calculation.
Source

pub fn getEpsilon(self: &INormalizationLayer) -> f32

Get the epsilon value used for the normalization calculation.

The epsilon value used for the normalization calculation.

Source

pub fn setAxes(self: Pin<&mut INormalizationLayer>, axesMask: u32)

Set the reduction axes for the normalization calculation.

  • axesMask The axes used for the normalization calculation.
Source

pub fn getAxes(self: &INormalizationLayer) -> u32

Get the axes value used for the normalization calculation.

The axes used for the normalization calculation.

Source

pub fn setNbGroups(self: Pin<&mut INormalizationLayer>, nbGroups: i64)

Set the number of groups used to split the channels in the normalization calculation.

The input tensor channels are divided into nbGroups groups, and normalization is performed per group. The channel dimension is considered to be the second dimension in a [N, C, H, W, …] formatted tensor.

The default nbGroups is 1.

It is an error to set nbGroups to a value that does not evenly divide into the number of channels of the input tensor.

When nbGroups is != 1, it is expected that the provided axesMask will have all bits corresponding to dimensions after the channel dimension set to 1, with all other bits set to 0.

  • nbGroups The number of groups to split the channels into for the normalization calculation.
Source

pub fn getNbGroups(self: &INormalizationLayer) -> i64

Get the number of groups used to split the channels for the normalization calculation.

The number of groups used to split the channel used for the normalization calculation.

Source

pub fn isV2(self: &INormalizationLayer) -> bool

Returns true if this layer was created through addNormalizationV2().

Whether the layer was created through addNormalizationV2().

Trait Implementations§

Source§

impl AsLayer for INormalizationLayer

Source§

fn as_layer(&self) -> &ILayer

Source§

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

Source§

impl AsLayerTyped for INormalizationLayer

Source§

const TYPE: LayerType = LayerType::kNORMALIZATION

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

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, N, o, r, m, a, l, i, z, a, t, i, o, n, 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 INormalizationLayer

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut INormalizationLayer

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

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.