code: def preprocess_module(mod):
      """
      Pre-process a module containing functions ready for ACL codegen. For now we enforce OHWI
      kernel layout and fold the transforms away.
  
      Parameters
      ----------
      mod : Module
          The module to run passes on.
  
      Returns
      -------
      preprocessed_mod : The processed module.
      """
  
      def convert_layout_conv2d(conv2d_function):
          def convert_conv(attrs, inputs, tinfos, desired_layouts):
              new_attrs = dict(attrs)
              data_info = tinfos[0]
              weight_info = tinfos[1]
              desired_data_layout, desired_kernel_layout = map(
                  str, desired_layouts
              )
              new_attrs["data_layout"] = desired_data_layout
              new_attrs["kernel_layout"] = desired_kernel_layout
  
              if is_depthwise_conv2d(
                  data_info.shape,
                  attrs["data_layout"],
                  weight_info.shape,
                  attrs["kernel_layout"],
                  attrs["groups"],
              ):
                  dkl = desired_kernel_layout
                  new_attrs["kernel_layout"] = (
                      dkl[3] + dkl[1:3] + dkl[0]
                  )
              return conv2d_function(*inputs, **new_attrs)
  
          return convert_conv
  
      with OpAttrContext(
          "nn.conv2d",
          "FTVMConvertOpLayout",
          convert_layout_conv2d(tvm.relay.nn.conv2d),
      ), OpAttrContext(
          "qnn.conv2d",
          "FTVMConvertOpLayout",
          convert_layout_conv2d(tvm.relay.qnn.op.conv2d),
      ):
          seq = tvm.transform.Sequential(
              [
                  transform.ConvertLayout(
                      {
                          "nn.conv2d": ["NHWC", "OHWI"],
                          "qnn.conv2d": ["NHWC", "OHWI"],
                      }
                  ),
                  transform.FoldConstant(),
              ]
          )
          preprocessed_mod = seq(mod)
      return preprocessed_mod
  
imports: import tvm
  from tvm import relay
  from tvm._ffi import register_func
  from tvm.relay import transform
  from tvm.relay.build_module import bind_params_by_name
  from tvm.relay.expr import const
  from ...dataflow_pattern import is_constant, is_expr, is_op, is_tuple, wildcard
  from ..strategy.generic import is_depthwise_conv2d
  from .register import register_pattern_table
label_desc: Use image node_id 3 for calling a global function with example usage: preprocess_module(mod) and returns: preprocessed_mod, convert_conv, conv2d_function