code: def average_pool(input_layer, kernel, stride, edges=PAD_SAME, name=PROVIDED):
    
    return _pool(input_layer, tf.nn.avg_pool, kernel, stride, edges, name)
docs: Performs average pooling.
  
    `kernel` is the patch that will be pooled and it describes the pooling along
    each of the 4 dimensions.  `stride` is how big to take each step.
  
    Because more often than not, pooling is only done
    on the width and height of the image, the following shorthands are supported:
  
    * scalar (e.g. 3): Square pooling on the image
        (`[b, c, r, d] = [1, 3, 3, 1]`).
    * singleton list (e.g. [3]): Square pooling on the image
        (`[b, c, r, d] = [1, 3, 3, 1]`).
    * list of length 2 (e.g. [3, 2]): Square pooling on the image
        (`[b, c, r, d] = [1, 3, 2, 1]`).
  
    Args:
      input_layer: The chainable object, supplied.
      kernel: The size of the patch for the pool, either an int or a length 1 or
        2 sequence (if length 1 or int, it is expanded).
      stride: The strides as a length 1, 2 or 4 sequence or an integer. If an
        int, length 1 or 2, the stride in the first and last dimensions are 1.
      edges: Either `pt.PAD_SAME`' or `pt.PAD_VALID` to control the padding.
      name: The name for this operation is also used to create/find the
        parameter variables.
    Returns:
      Handle to this layer.