chainer.functions.max_pooling_nd

chainer.functions.max_pooling_nd(x, ksize, stride=None, pad=0, cover_all=True, return_indices=False)[source]

N-dimensionally spatial max pooling function.

Warning

This feature is experimental. The interface can change in the future.

This function provides a N-dimensionally generalized version of max_pooling_2d(). This acts similarly to convolution_nd(), but it computes the maximum of input spatial patch for each channel without any parameter instead of computing the inner products.

Parameters:
  • x (Variable) – Input variable.
  • ksize (int or tuple of ints) – Size of pooling window. ksize=k and ksize=(k, k, ..., k) are equivalent.
  • stride (int or tuple of ints or None) – Stride of pooling applications. stride=s and stride=(s,s, ..., s) are equivalent. If None is specified, then it uses same stride as the pooling window size.
  • pad (int or tuple of ints) – Spatial padding width for the input array. pad=p and pad=(p, p, ..., p) are equivalent.
  • cover_all (bool) – If True, all spatial locations are pooled into some output pixels. It may make the output size larger.
  • return_indices (bool) – If True, pooling indices array is returned together with the output variable. The returned indices are expected for use by chainer.functions.upsampling_nd(). Note that cuDNN will not be used for this function if return_indices is set to True, as cuDNN does not return indices information.
Returns:

When return_indices is False (default), returns the output variable. When False, returns the tuple of the output variable and pooling indices (ndarray). Pooling indices will be on the same device as the input.

Return type:

Variable or tuple