code: def test_global_pooling():
      device = Device()
      np.random.seed(0)
  
      dtype = "float32"
  
      trials = [
          ["nn.global_max_pool2d", (8, 8, 16)],
          ["nn.global_max_pool2d", (9, 9, 16)],
          ["nn.global_max_pool2d", (8, 8, 16)],
          ["nn.global_avg_pool2d", (8, 8, 16)],
          ["nn.global_avg_pool2d", (8, 8, 16)],
          ["nn.global_avg_pool2d", (9, 9, 16)],
      ]
  
      for typef, input_shape in trials:
          shape = (1, *input_shape)
          outputs = []
          inputs = {
              "a": tvm.nd.array(
                  np.random.uniform(-127, 128, shape).astype(dtype)
              ),
          }
  
          func = _get_global_pooling_model(
              shape, dtype, typef, iter(inputs)
          )
          config = {
              "shape": shape,
              "pooling type": typef,
              "dtype": dtype,
          }
  
          for enable_bnns in [False, True]:
              outputs.append(
                  build_and_run(
                      func,
                      inputs,
                      1,
                      None,
                      device,
                      enable_bnns=enable_bnns,
                      config=config,
                  )[0]
              )
  
          verify(outputs, atol=0.001, rtol=0.001, config=config)
  
file_path: tvm/tests/python/contrib/test_bnns/test_pooling.py
imports: import numpy
  import pytest
  import tvm
  from tvm import relay
  from tvm import testing
  from .infrastructure import skip_runtime_test, skip_codegen_test, build_and_run, verify, verify_codegen
  from .infrastructure import Device
label_desc: Use image node_id 7 for calling a global function with example usage: test_global_pooling() without return types