code: def _get_pooling_model(
      shape,
      dtype,
      typef,
      sizes,
      strides,
      padding,
      ceil_mode,
      count_include_pad,
      var_names,
  ):
      """Return a model and any parameters it may have."""
      if len(padding) == 2:
          padding = (padding[0], padding[1], padding[0], padding[1])
      out = relay.var(next(var_names), shape=shape, dtype=dtype)
  
      if typef == "nn.max_pool2d":
          out = relay.nn.max_pool2d(
              out,
              pool_size=sizes,
              strides=strides,
              padding=padding,
              ceil_mode=ceil_mode,
          )
      elif typef == "nn.avg_pool2d":
          out = relay.nn.avg_pool2d(
              out,
              pool_size=sizes,
              strides=strides,
              padding=padding,
              ceil_mode=ceil_mode,
              count_include_pad=count_include_pad,
          )
      else:
          raise ValueError("Function not supported")
  
      return out
  
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 2 for calling a global function with example usage: _get_pooling_model(shape, dtype, typef, sizes, strides, padding, ceil_mode, count_include_pad, var_names) and returns: out