pub struct PoolingLayerParams {
pub type: i32,
pub kernel_size: Vec<u64>,
pub stride: Vec<u64>,
pub avg_pool_exclude_padding: bool,
pub global_pooling: bool,
pub pooling_padding_type: Option<PoolingPaddingType>,
}Expand description
A spatial pooling layer.
.. code::
y = PoolingLayer(x)Requires 1 input and produces 1 output.
Input A blob with rank greater than equal to 4. Rank 4 blob represents [Batch, channels, height, width] For ranks greater than 4, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
Output Rank is same as the input. e.g.: for rank 4 input, output shape is [B, C, H_out, W_out]
Padding options are similar to ConvolutionLayerParams
with the additional option of ValidCompletePadding (includeLastPixel),
which ensures that the last application of the kernel
always includes the last pixel of the input image, if there is padding.
.. code::
H_out = ceil(float(H_in + 2 * paddingAmounts\[0\] - kernelSize\[0\])/float(Stride\[0\])) + 1
if (paddingAmounts\[0\] > 0 or paddingAmounts\[1\] > 0)
if ((H_out - 1) * Stride >= H_in + paddingAmounts\[0\]) {
H_out = H_out - 1
}
}The equivalent expressions hold true for W_out as well.
Only symmetric padding is supported with this option.
Fields§
§type: i32Type of pooling operation.
kernel_size: Vec<u64>Must be length 2 in the order \[H, W\].
If not set, default value \[3, 3\] is used.
stride: Vec<u64>Must be length 2 in the order \[H, W\].
If not set, default value \[1, 1\] is used.
avg_pool_exclude_padding: boolIf true, padded values are excluded from the count (denominator) when computing average pooling.
global_pooling: boolIf true, global pooling is performed. Kernel size is inferred from the input data spatial dimensions.
pooling_padding_type: Option<PoolingPaddingType>Implementations§
Source§impl PoolingLayerParams
impl PoolingLayerParams
Sourcepub fn type(&self) -> PoolingType
pub fn type(&self) -> PoolingType
Returns the enum value of type, or the default if the field is set to an invalid enum value.
Sourcepub fn set_type(&mut self, value: PoolingType)
pub fn set_type(&mut self, value: PoolingType)
Sets type to the provided enum value.
Trait Implementations§
Source§impl Clone for PoolingLayerParams
impl Clone for PoolingLayerParams
Source§fn clone(&self) -> PoolingLayerParams
fn clone(&self) -> PoolingLayerParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PoolingLayerParams
impl Debug for PoolingLayerParams
Source§impl Default for PoolingLayerParams
impl Default for PoolingLayerParams
Source§impl Message for PoolingLayerParams
impl Message for PoolingLayerParams
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for PoolingLayerParams
impl PartialEq for PoolingLayerParams
Source§fn eq(&self, other: &PoolingLayerParams) -> bool
fn eq(&self, other: &PoolingLayerParams) -> bool
self and other values to be equal, and is used by ==.