code: def _bitserial_conv2d_legalize(attrs, inputs, arg_types):
      """Legalizes Bitserial Conv2D op.
  
      Parameters
      ----------
      attrs : tvm.ir.Attrs
          Attributes of current convolution
      inputs : list of tvm.relay.Expr
          The args of the Relay expr to be legalized
      types : list of types
          List of input and output types
  
      Returns
      -------
      result : tvm.relay.Expr
          The legalized expr
      """
  
      # Fix different kernel layouts where possible.
      if attrs["data_layout"] == "NHWC":
          data, kernel = inputs
          if len(kernel.data.shape) == 4:
              # HWIO layout is expected for NHWC input.
              if attrs["kernel_layout"] == "HWOI":
                  # Handle HWOI layout. This is common in TF depthwise conv2d graph.
                  kernel = relay.transpose(kernel, axes=(0, 1, 3, 2))
              elif attrs["kernel_layout"] == "OIHW":
                  kernel = relay.transpose(kernel, axes=(2, 3, 1, 0))
              ## Set new attrs for the tranposed conv.
              new_attrs = {k: attrs[k] for k in attrs.keys()}
              new_attrs["kernel_layout"] = "HWIO"
  
              conv = relay.nn.bitserial_conv2d(
                  data, kernel, **new_attrs
              )
              return conv
      return None
  
file_path: tvm/python/tvm/topi/arm_cpu/bitserial_conv2d.py
imports: from __future__ import absolute_import
  import tvm
  from tvm import te
  from tvm import autotvm
  from tvm import relay
  from ..nn.pad import pad
  from ..nn.bitserial_conv2d import bitserial_conv2d_legalize
  from ..nn.bitserial_util import bitpack, binary_op_multiplier
  from ..nn.utils import get_pad_tuple
  from ..utils import get_const_int, get_const_tuple, traverse_inline
label_desc: Use image node_id 6 for calling a global function with example usage: _bitserial_conv2d_legalize(attrs, inputs, arg_types) and returns: None, conv