One easy and common choice is the so-called max-pooling operator, which simply outputs the maximum activation as observed in the region. In TensorFlow, if we want to define a max pooling layer of size 2 x 2, we will write the following:
tf.nn.max_pool(value, ksize, strides, padding, data_format='NHWC', name=None)
These are the arguments:
- value: A 4-D Tensor with shape [batch, height, width, channels]and type tf.float32.
- ksize: A list of ints that has length >= 4. The size of the window for each dimension of the input tensor.
- strides: A list of ints that has length >= 4. The stride of the sliding window for each dimension of the input tensor.
- padding: A string, either VALID or SAME.
- data_format: A string. NHWC and NCHW are supported.
- name: Optional name for the operation.
An example of the max pooling operation is given in the following image:
An example of pooling operation