Skip to main content

IPoolingLayer

Struct IPoolingLayer 

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

IPoolingLayer

A Pooling layer in a network definition.

The layer applies a reduction operation within a window over the input.

When running pooling layer with DeviceType::kDLA in Int8 mode, the dynamic ranges for input and output tensors must be equal.

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

Implementations§

Source§

impl IPoolingLayer

Source

pub fn setPoolingType(self: Pin<&mut IPoolingLayer>, type_: PoolingType)

Set the type of activation to be performed.

DLA only supports kMAX and kAVERAGE pooling types.

See [getPoolingType()], PoolingType

Source

pub fn getPoolingType(self: &IPoolingLayer) -> PoolingType

Get the type of activation to be performed.

See [setPoolingType()], PoolingType

Source

pub fn setBlendFactor(self: Pin<&mut IPoolingLayer>, blendFactor: f32)

Set the blending factor for the max_average_blend mode: max_average_blendPool = (1-blendFactor)maxPool + blendFactoravgPool blendFactor is a user value in [0,1] with the default value of 0.0 This value only applies for the kMAX_AVERAGE_BLEND mode.

Since DLA does not support kMAX_AVERAGE_BLEND, blendFactor is ignored on the DLA.

See [getBlendFactor()]

Source

pub fn getBlendFactor(self: &IPoolingLayer) -> f32

Get the blending factor for the max_average_blend mode: max_average_blendPool = (1-blendFactor)maxPool + blendFactoravgPool blendFactor is a user value in [0,1] with the default value of 0.0 In modes other than kMAX_AVERAGE_BLEND, blendFactor is ignored.

See [setBlendFactor()]

Source

pub fn setAverageCountExcludesPadding( self: Pin<&mut IPoolingLayer>, exclusive: bool, )

Set whether average pooling uses as a denominator the overlap area between the window and the unpadded input. If this is not set, the denominator is the overlap between the pooling window and the padded input.

Default: true

See [getAverageCountExcludesPadding()]

Source

pub fn getAverageCountExcludesPadding(self: &IPoolingLayer) -> bool

Get whether average pooling uses as a denominator the overlap area between the window and the unpadded input.

See [setAverageCountExcludesPadding()]

Source

pub fn setPrePadding(self: Pin<&mut IPoolingLayer>, padding: &Dims64)

Set the multi-dimension pre-padding for pooling.

The start of the input will be padded by this number of elements in each dimension. Padding value depends on pooling type, -inf is used for max pooling and zero padding for average pooling.

Default: (0, 0, …, 0)

If executing this layer on DLA, only support 2D padding, both height and width of padding must be in the range [0,7].

See [getPrePadding()]

Source

pub fn getPrePadding(self: &IPoolingLayer) -> Dims64

Get the pre-padding.

See [setPrePadding()]

Source

pub fn setPostPadding(self: Pin<&mut IPoolingLayer>, padding: &Dims64)

Set the multi-dimension post-padding for pooling.

The end of the input will be padded by this number of elements in each dimension. Padding value depends on pooling type, -inf is used for max pooling and zero padding for average pooling.

Default: (0, 0, …, 0)

If executing this layer on DLA, only support 2D padding, both height and width of padding must be in the range [0,7].

See [getPostPadding()]

Source

pub fn getPostPadding(self: &IPoolingLayer) -> Dims64

Get the padding.

See [setPostPadding()]

Source

pub fn setPaddingMode(self: Pin<&mut IPoolingLayer>, paddingMode: PaddingMode)

Set the padding mode.

Padding mode takes precedence if both setPaddingMode and setPre/PostPadding are used.

Default: kEXPLICIT_ROUND_DOWN

See [getPaddingMode()]

Source

pub fn getPaddingMode(self: &IPoolingLayer) -> PaddingMode

Get the padding mode.

Default: kEXPLICIT_ROUND_DOWN

See [setPaddingMode()]

Source

pub fn setWindowSizeNd(self: Pin<&mut IPoolingLayer>, windowSize: &Dims64)

Set the multi-dimension window size for pooling.

If executing this layer on DLA, only support 2D window size, both height and width of window size must be in the range [1,8].

See [getWindowSizeNd()] setWindowSize() getWindowSize()

Source

pub fn getWindowSizeNd(self: &IPoolingLayer) -> Dims64

Get the multi-dimension window size for pooling.

See [setWindowSizeNd()]

Source

pub fn setStrideNd(self: Pin<&mut IPoolingLayer>, stride: &Dims64)

Set the multi-dimension stride for pooling.

Default: (1, 1, …, 1)

If executing this layer on DLA, only support 2D stride, both height and width of stride must be in the range [1,16].

See [getStrideNd()]

Source

pub fn getStrideNd(self: &IPoolingLayer) -> Dims64

Get the multi-dimension stride for pooling.

See [setStrideNd()]

Source

pub fn setPaddingNd(self: Pin<&mut IPoolingLayer>, padding: &Dims64)

Set the multi-dimension padding for pooling.

The input will be padded by this number of elements in each dimension. Padding is symmetric. Padding value depends on pooling type, -inf is used for max pooling and zero padding for average pooling.

Default: (0, 0, …, 0)

If executing this layer on DLA, only support 2D padding, both height and width of padding must be in the range [0,7].

See [getPaddingNd()] setPadding() getPadding()

Source

pub fn getPaddingNd(self: &IPoolingLayer) -> Dims64

Get the multi-dimension padding for pooling.

If the padding is asymmetric, the pre-padding is returned.

See [setPaddingNd()]

Trait Implementations§

Source§

impl AsLayer for IPoolingLayer

Source§

fn as_layer(&self) -> &ILayer

Source§

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

Source§

impl AsLayerTyped for IPoolingLayer

Source§

const TYPE: LayerType = LayerType::kPOOLING

Source§

impl AsRef<ILayer> for IPoolingLayer

Source§

fn as_ref(self: &IPoolingLayer) -> &ILayer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl ExternType for IPoolingLayer

Source§

type Id = (n, v, i, n, f, e, r, _1, (), I, P, o, o, l, i, n, g, 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 IPoolingLayer

Source§

unsafe fn allocate_uninitialized_cpp_storage() -> *mut IPoolingLayer

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

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.