code: def global_avg_pool(incoming, name="GlobalAvgPool"):
      """Global Average Pooling.
  
      Input:
          4-D Tensor [batch, height, width, in_channels].
  
      Output:
          2-D Tensor [batch, pooled dim]
  
      Arguments:
          incoming: `Tensor`. Incoming 4-D Tensor.
          name: A name for this layer (optional). Default: 'GlobalAvgPool'.
  
      """
      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
      )
  
      with tf.name_scope(name):
          inference = tf.reduce_mean(incoming, [1, 2])
  
      # 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 18 for calling a global function with example usage: global_avg_pool(incoming, name) and returns: inference