Skip to main content

IScaleLayer

Struct IScaleLayer 

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

! ! \class IScaleLayer ! ! \brief A Scale layer in a network definition. ! ! This layer applies a per-element computation to its input: ! ! \p output = (\p input* \p scale + \p shift)^ \p power ! ! The coefficients can be applied on a per-tensor, per-channel, or per-element basis. ! ! \note If the number of weights is 0, then a default value is used for shift, power, and scale. ! The default shift is 0, the default power is 1, and the default scale is 1. ! ! The output size is the same as the input size. ! ! \note The input tensor is required to have at least 4 dimensions. ! ! A scale layer may be used as an INT8 quantization node in a graph, if the output is constrained to INT8 and ! the input to FP32. Quantization rounds ties to even, and clamps to [-128, 127]. ! ! \see ScaleMode ! ! \warning Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI. !

Implementations§

Source§

impl IScaleLayer

Source

pub fn setMode(self: Pin<&mut IScaleLayer>, mode: ScaleMode)

! ! \brief Set the scale mode. ! ! \see getMode() !

Source

pub fn getMode(self: &IScaleLayer) -> ScaleMode

! ! \brief Get the scale mode. ! ! \see setMode() !

Source

pub fn setShift(self: Pin<&mut IScaleLayer>, shift: Weights)

! ! \brief Set the shift value. ! ! \see getShift() !

Source

pub fn getShift(self: &IScaleLayer) -> Weights

! ! \brief Get the shift value. ! ! \see setShift() !

Source

pub fn setScale(self: Pin<&mut IScaleLayer>, scale: Weights)

! ! \brief Set the scale value. ! ! \see getScale() !

Source

pub fn getScale(self: &IScaleLayer) -> Weights

! ! \brief Get the scale value. ! ! \see setScale() !

Source

pub fn setPower(self: Pin<&mut IScaleLayer>, power: Weights)

! ! \brief Set the power value. ! ! \see getPower() !

Source

pub fn getPower(self: &IScaleLayer) -> Weights

! ! \brief Get the power value. ! ! \see setPower() !

Source

pub fn getChannelAxis(self: &IScaleLayer) -> i32

! ! \brief Get the channel axis. ! ! \return channelAxis parameter passed to addScaleNd() or set by setChannelAxis() ! ! The value is the index of the channel axis in the input tensor’s dimensions. ! Scaling happens along the channel axis when ScaleMode::kCHANNEL is enabled. ! ! \see addScaleNd() !

Source

pub fn setChannelAxis(self: Pin<&mut IScaleLayer>, channelAxis: i32)

! ! \brief Set the channel axis. ! ! The value is the index of the channel axis in the input tensor’s dimensions. ! ! For ScaleMode::kCHANNEL, there can be distinct scale, shift, and power weights for each channel coordinate. ! For ScaleMode::kELEMENTWISE, there can be distinct scale, shift, and power weights for each combination of ! coordinates from the channel axis and axes after it. ! ! For example, suppose the input tensor has dimensions [10,20,30,40] and the channel axis is 1. ! Let [n,c,h,w] denote an input coordinate. ! For ScaleMode::kCHANNEL, the scale, shift, and power weights are indexed by c. ! For ScaleMode::kELEMENTWISE, the scale, shift, and power weights are indexed by [c,h,w]. ! ! \see addScaleNd() !

Trait Implementations§

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

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, S, c, a, l, e, 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 IScaleLayer

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut IScaleLayer

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

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.