code: def test_pooling():
      device = Device()
      np.random.seed(0)
  
      dtype = "float32"
      trials = [
          [
              "nn.max_pool2d",
              (3, 3),
              (2, 2),
              (0, 0),
              False,
              False,
              (27, 27, 512),
          ],
          [
              "nn.max_pool2d",
              (2, 2),
              (2, 2),
              (0, 0),
              False,
              True,
              (16, 16, 16),
          ],
          [
              "nn.max_pool2d",
              (3, 3),
              (2, 2),
              (1, 1),
              True,
              True,
              (15, 15, 16),
          ],
          [
              "nn.max_pool2d",
              (2, 2),
              (2, 2),
              (0, 1),
              False,
              False,
              (16, 16, 16),
          ],
          [
              "nn.avg_pool2d",
              (2, 2),
              (2, 2),
              (1, 1),
              False,
              False,
              (16, 16, 16),
          ],
          [
              "nn.avg_pool2d",
              (2, 2),
              (2, 2),
              (0, 0),
              False,
              True,
              (16, 16, 16),
          ],
          [
              "nn.avg_pool2d",
              (3, 3),
              (2, 2),
              (0, 1),
              True,
              False,
              (15, 15, 16),
          ],
      ]
  
      for (
          typef,
          size,
          stride,
          pad,
          ceil_mode,
          count_include_pad,
          input_shape,
      ) in trials:
          shape = (1, *input_shape)
          outputs = []
          inputs = {
              "a": tvm.nd.array(
                  np.random.uniform(-127, 128, shape).astype(dtype)
              ),
          }
  
          func = _get_pooling_model(
              shape,
              dtype,
              typef,
              size,
              stride,
              pad,
              ceil_mode,
              count_include_pad,
              iter(inputs),
          )
  
          config = {
              "size": size,
              "stride": stride,
              "shape": shape,
              "pooling type": typef,
              "dtype": dtype,
              "padding": pad,
              "ceil_mode": ceil_mode,
              "count_include_pad": count_include_pad,
              "inputs": inputs,
          }
  
          params = None
          for enable_bnns in [False, True]:
              outputs.append(
                  build_and_run(
                      func,
                      inputs,
                      1,
                      params,
                      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 6 for calling a global function with example usage: test_pooling() without return types