Intel(R) Math Kernel Library for Deep Neural Networks (Intel(R) MKL-DNN)  0.21.0
Performance library for Deep Learning
Functions

A primitive to perform max or average pooling. More...

Functions

mkldnn_status_t MKLDNN_API mkldnn_pooling_forward_desc_init (mkldnn_pooling_desc_t *pool_desc, mkldnn_prop_kind_t prop_kind, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *src_desc, const mkldnn_memory_desc_t *dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t kernel, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r, mkldnn_padding_kind_t padding_kind)
 Initializes a pooling descriptor pool_desc for forward propagation using prop_kind (possible values are mkldnn_forward_training and mkldnn_forward_inference), alg_kind, memory descriptors, and pooling parameters in the spatial domain: strides, kernel sizes, padding_l, padding_r, and padding_kind. More...
 
mkldnn_status_t MKLDNN_API mkldnn_pooling_backward_desc_init (mkldnn_pooling_desc_t *pool_desc, mkldnn_alg_kind_t alg_kind, const mkldnn_memory_desc_t *diff_src_desc, const mkldnn_memory_desc_t *diff_dst_desc, const mkldnn_dims_t strides, const mkldnn_dims_t kernel, const mkldnn_dims_t padding_l, const mkldnn_dims_t padding_r, mkldnn_padding_kind_t padding_kind)
 Initializes a pooling descriptor pool_desc for backward propagation using alg_kind, memory descriptors, and pooling parameters in the spatial domain: strides, kernel sizes, padding_l, padding_r, and padding_kind. More...
 

Detailed Description

A primitive to perform max or average pooling.

Max pooling:

\[dst[n][oc][oh][ow] = \max\limits_{kw,kh} (src[n][ic][oh \cdot s_h - p_l[0] + kh][ow \cdot s_w - p_r[1] + kw]),\]

Average pooling:

\[dst[n][oc][oh][ow] = \frac{1}{KW \cdot KH}\sum\limits_{kw,kh} src[n][ic][oh \cdot s_h - p_l[0] + kh][ow \cdot s_w - p_r[1] + kw],\]

where $p_l, p_r$ are padding_l and padding_r respectively, and output spatial dimensions are calculated similarly to how they are done in convolution.

During training, max pooling requires a workspace on forward (mkldnn_forward_training) and backward (mkldnn_backward) passes to save indices where maximum was found. The workspace layout is opaque, and the indices cannot be restored from it. However, one can use backward pooling to perform up-sampling (used in some detection topologies).

Function Documentation

◆ mkldnn_pooling_forward_desc_init()

mkldnn_status_t MKLDNN_API mkldnn_pooling_forward_desc_init ( mkldnn_pooling_desc_t pool_desc,
mkldnn_prop_kind_t  prop_kind,
mkldnn_alg_kind_t  alg_kind,
const mkldnn_memory_desc_t src_desc,
const mkldnn_memory_desc_t dst_desc,
const mkldnn_dims_t  strides,
const mkldnn_dims_t  kernel,
const mkldnn_dims_t  padding_l,
const mkldnn_dims_t  padding_r,
mkldnn_padding_kind_t  padding_kind 
)

Initializes a pooling descriptor pool_desc for forward propagation using prop_kind (possible values are mkldnn_forward_training and mkldnn_forward_inference), alg_kind, memory descriptors, and pooling parameters in the spatial domain: strides, kernel sizes, padding_l, padding_r, and padding_kind.

Note
If padding_r is NULL, the padding is supposed to be symmetric.

Order of inputs:

Order of outputs:

◆ mkldnn_pooling_backward_desc_init()

mkldnn_status_t MKLDNN_API mkldnn_pooling_backward_desc_init ( mkldnn_pooling_desc_t pool_desc,
mkldnn_alg_kind_t  alg_kind,
const mkldnn_memory_desc_t diff_src_desc,
const mkldnn_memory_desc_t diff_dst_desc,
const mkldnn_dims_t  strides,
const mkldnn_dims_t  kernel,
const mkldnn_dims_t  padding_l,
const mkldnn_dims_t  padding_r,
mkldnn_padding_kind_t  padding_kind 
)

Initializes a pooling descriptor pool_desc for backward propagation using alg_kind, memory descriptors, and pooling parameters in the spatial domain: strides, kernel sizes, padding_l, padding_r, and padding_kind.

Note
If padding_r is NULL, the padding is supposed to be symmetric.

Order of inputs:

Order of outputs: