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
impl IScaleLayer
Sourcepub fn setMode(self: Pin<&mut IScaleLayer>, mode: ScaleMode)
pub fn setMode(self: Pin<&mut IScaleLayer>, mode: ScaleMode)
! ! \brief Set the scale mode. ! ! \see getMode() !
Sourcepub fn getMode(self: &IScaleLayer) -> ScaleMode
pub fn getMode(self: &IScaleLayer) -> ScaleMode
! ! \brief Get the scale mode. ! ! \see setMode() !
Sourcepub fn setShift(self: Pin<&mut IScaleLayer>, shift: Weights)
pub fn setShift(self: Pin<&mut IScaleLayer>, shift: Weights)
! ! \brief Set the shift value. ! ! \see getShift() !
Sourcepub fn getShift(self: &IScaleLayer) -> Weights
pub fn getShift(self: &IScaleLayer) -> Weights
! ! \brief Get the shift value. ! ! \see setShift() !
Sourcepub fn setScale(self: Pin<&mut IScaleLayer>, scale: Weights)
pub fn setScale(self: Pin<&mut IScaleLayer>, scale: Weights)
! ! \brief Set the scale value. ! ! \see getScale() !
Sourcepub fn getScale(self: &IScaleLayer) -> Weights
pub fn getScale(self: &IScaleLayer) -> Weights
! ! \brief Get the scale value. ! ! \see setScale() !
Sourcepub fn setPower(self: Pin<&mut IScaleLayer>, power: Weights)
pub fn setPower(self: Pin<&mut IScaleLayer>, power: Weights)
! ! \brief Set the power value. ! ! \see getPower() !
Sourcepub fn getPower(self: &IScaleLayer) -> Weights
pub fn getPower(self: &IScaleLayer) -> Weights
! ! \brief Get the power value. ! ! \see setPower() !
Sourcepub fn getChannelAxis(self: &IScaleLayer) -> i32
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() !
Sourcepub fn setChannelAxis(self: Pin<&mut IScaleLayer>, channelAxis: i32)
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() !