VL_NNPOOL - CNN poolinng.

Y = VL_NNPOOL(X, POOL) applies the pooling operator to all channels of the data X using a square filter of size POOL. X is a SINGLE array of dimension H x W x D x N where (H,W) are the height and width of the map stack, D is the image depth (number of feature channels) and N the number of of images in the stack.

Y = VL_NNPOOL(X, [POOLY, POOLX]) uses a rectangular filter of height POOLY and width POOLX.

DZDX = VL_NNPOOL(X, POOL, DZDY) computes the derivatives of the block projected onto DZDY. DZDX and DZDY have the same dimensions as X and Y respectively.

VL_NNPOOL(..., 'option', value, ...) takes the following options:

The pooling window must be not larger than the padded image, i.e.

  1 <= POOLY <= HEIGHT + (PADTOP + PADBOTTOM),
  1 <= POOLX <= WIDTH + (PADLEFT + PADRIGHT).

The output a is a SINGLE array of dimension YH x YW x K x N of N images with K challens and size:

  YH = floor((H + (PADTOP+PADBOTTOM) - POOLY)/STRIDEY) + 1,
  YW = floor((W + (PADLEFT+PADRIGHT) - POOLX)/STRIDEX) + 1.

The derivative DZDY has the same dimension of the output Y and the derivative DZDX has the same dimension as the input X.

CUDNN SUPPORT

If compiled in, the function will use cuDNN convolution routines (with the exception of asymmetric left-right or top-bottom padding and average pooling that triggers a bug in cuDNN). You can use the 'NoCuDNN' option to disable cuDNN or 'cuDNN' to activate it back again (the choice sticks until MATLAB purges the MEX files for any reason).