code: def adaptive_pool(np_data, out_size, pool_type, layout):
      """The reference function for adaptive pool, for 2d and 3d"""
      if isinstance(out_size, int):
          out_size = (out_size,)
      if len(out_size) == 1:
          pool_op = _pool1d
      elif len(out_size) == 2:
          pool_op = _pool2d
      else:
          assert len(out_size) == 3
          pool_op = _pool3d
  
      np_op = np.mean if pool_type == "avg" else np.max
  
      if layout in ["NCW", "NCHW", "NCDHW"]:
          return adaptive_pool_channel_first(
              np_data, out_size, pool_op, np_op
          )
  
      assert layout in ["NWC", "NHWC", "NDHWC"]
      return adaptive_pool_channel_last(
          np_data, out_size, pool_op, np_op
      )
  
file_path: tvm/python/tvm/topi/testing/adaptive_pool_python.py
imports: import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: adaptive_pool(np_data, out_size, pool_type, layout) and returns: adaptive_pool_channel_last, adaptive_pool_channel_first