code: def global_avg_pool(x, data_format=INVALID):
      """Average pool away the height and width spatial dimensions of x."""
      assert data_format != INVALID
      assert data_format in ["NHWC", "NCHW"]
      assert x.shape.ndims == 4
      if data_format == "NHWC":
          return tf.reduce_mean(x, [1, 2])
      else:
          return tf.reduce_mean(x, [2, 3])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling a global function with example usage: global_avg_pool(x, data_format) and returns: tf, tf