Also available from the tf.nn package, tf.nn.max_pool() (refer to the documentation at https://www.tensorflow.org/api_docs/python/tf/nn/max_pool) and tf.nn.avg_pool() (refer to the documentation at https://www.tensorflow.org/api_docs/python/tf/nn/avg_pool) conveniently have a signature quite similar to tf.nn.conv2d(), as follows:
- value: The batch of input images of shape (B, H, W, D), with B being the batch size
- ksize: A list of four integers representing the window size in each dimension; commonly, [1, k, k, 1] is used
- strides: A list of four integers representing the stride for each dimension of the batched input, similar to tf.nn.conv2d()
- padding: A string defining which padding algorithm to use (VALID or SAME)
- name: The name to identify this operation (useful for creating clear, readable graphs)
Figure 3.7 illustrates an average-pooling operation applied to an image:
Figure 3.7: Example of average-pooling performed on an image with TensorFlow...