pool - Definitions for all Pooling functions.

The file yann.core.pool.py contains the definition for all the Pooling functions available.

Todo

  • Need to support max_rand_pool and rand_pool
class yann.core.pool.pooler_2d(input, ds, img_shp, mode='max', ignore_border=True, verbose=1)[source]

function that performs pooling

Parameters:
  • input – This variable should either thenao.tensor4 (theano.matrix reshaped also works) variable or an output from a pervious layer which is a theano.tensor4 convolved with a theano.shared. The input should be of shape (batchsize, channels, height, width). For those who have tried pylearn2 or such, this is called bc01 format.
  • img_shp – This variable should a tuple or an array: [batchsize, channels, height, width]
  • ds – tuple of pool sizes for rows and columns. (pool height, pool width)
  • mode

    {‘max’, ‘sum’, ‘mean’, ‘max_same_size’} Operation executed on each window. max and sum

    • if max_same_size we do maxpooling with output is the same size.
    • if max we do do maxpooling with output being downsampled. Output size will be (batchsize, channels, height/ds[0], width/ds[1]).
    • if mean we do do meanpooling with output being downsampled. Output size will be (batchsize, channels, height/ds[0], width/ds[1]).
    • if sum we do do sum pooling with output being downsampled. Output size will be (batchsize, channels, height/ds[0], width/ds[1]).
  • ignore_border – (default is False) Consider theano’s documentation. It is directly supplied to theano’s pool module.