code: def avg_pool_2d(
      incoming,
      kernel_size,
      strides=None,
      padding="same",
      name="AvgPool2D",
  ):
      """Average Pooling 2D.
  
      Input:
          4-D Tensor [batch, height, width, in_channels].
  
      Output:
          4-D Tensor [batch, pooled height, pooled width, in_channels].
  
      Arguments:
          incoming: `Tensor`. Incoming 4-D Layer.
          kernel_size: `int` or `list of int`. Pooling kernel size.
          strides: `int` or `list of int`. Strides of conv operation.
              Default: same as kernel_size.
          padding: `str` from `"same", "valid"`. Padding algo to use.
              Default: 'same'.
          name: A name for this layer (optional). Default: 'AvgPool2D'.
  
      Attributes:
          scope: `Scope`. This layer scope.
  
      """
      input_shape = utils.get_incoming_shape(incoming)
      assert (
          len(input_shape) == 4
      ), "Incoming Tensor shape must be 4-D, not %d-D" % len(
          input_shape
      )
  
      kernel = utils.autoformat_kernel_2d(kernel_size)
      strides = (
          utils.autoformat_kernel_2d(strides) if strides else kernel
      )
      padding = utils.autoformat_padding(padding)
  
      with tf.name_scope(name) as scope:
          inference = tf.nn.avg_pool(incoming, kernel, strides, padding)
  
          # Track activations.
          tf.add_to_collection(tf.GraphKeys.ACTIVATIONS, inference)
  
      # Add attributes to Tensor to easy access weights
      inference.scope = scope
  
      # Track output tensor.
      tf.add_to_collection(
          tf.GraphKeys.LAYER_TENSOR + "/" + name, inference
      )
  
      return inference
  
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  import numpy
  from math import ceil
  import tflearn
  from ..None import variables
  from ..None import activations
  from ..None import initializations
  from ..None import regularizers
  from ..None import utils
  from ..layers.normalization import batch_normalization
label_desc: Use image node_id 6 for calling a global function with example usage: avg_pool_2d(incoming, kernel_size, strides, padding, name) and returns: inference