downsample – Down-Sampling

theano.tensor.signal.downsample.max_pool_2d(input, ds, ignore_border=None, st=None, padding=(0, 0), mode='max')

Takes as input a N-D tensor, where N >= 2. It downscales the input image by the specified factor, by keeping only the maximum value of non-overlapping patches of size (ds[0],ds[1])

Parameters:
  • input (N-D theano tensor of input images) – Input images. Max pooling will be done over the 2 last dimensions.
  • ds (tuple of length 2) – Factor by which to downscale (vertical ds, horizontal ds). (2,2) will halve the image in each dimension.
  • ignore_border (bool (default None, will print a warning and set to False)) – When True, (5,5) input with ds=(2,2) will generate a (2,2) output. (3,3) otherwise.
  • st (tuple of lenght 2) – Stride size, which is the number of shifts over rows/cols to get the next pool region. If st is None, it is considered equal to ds (no overlap on pooling regions).
  • padding (tuple of two ints) – (pad_h, pad_w), pad zeros to extend beyond four borders of the images, pad_h is the size of the top and bottom margins, and pad_w is the size of the left and right margins.
  • mode ({‘max’, ‘sum’, ‘average_inc_pad’, ‘average_exc_pad’}) – Operation executed on each window. max and sum always exclude the padding in the computation. average gives you the choice to include or exclude it.
theano.tensor.signal.downsample.max_pool_2d_same_size(input, patch_size)

Takes as input a 4-D tensor. It sets all non maximum values of non-overlapping patches of size (patch_size[0],patch_size[1]) to zero, keeping only the maximum values. The output has the same dimensions as the input.

Parameters:
  • input (4-D theano tensor of input images) – Input images. Max pooling will be done over the 2 last dimensions.
  • patch_size (tuple of length 2) – Size of the patch (patch height, patch width). (2,2) will retain only one non-zero value per patch of 4 values.
downsample.fft(*todo)

[James has some code for this, but hasn’t gotten it into the source tree yet.]