chainer.functions.max_pooling_2d¶
-
chainer.functions.max_pooling_2d(x, ksize, stride=None, pad=0, cover_all=True, return_indices=False)[source]¶ Spatial max pooling function.
This function acts similarly to
convolution_2d(), 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 pair of ints) – Size of pooling window.
ksize=kandksize=(k, k)are equivalent.stride (int or pair of ints or None) – Stride of pooling applications.
stride=sandstride=(s, s)are equivalent. IfNoneis specified, then it uses same stride as the pooling window size.pad (int or pair of ints) – Spatial padding width for the input array.
pad=pandpad=(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 bychainer.functions.upsampling_2d(). Note that cuDNN will not be used for this function ifreturn_indicesis set toTrue, as cuDNN does not return indices information.
- Returns
When
return_indicesisFalse(default), returns the output variable. WhenTrue, returns the tuple of the output variable and pooling indices (ndarray). Pooling indices will be on the same device as the input.- Return type