code: def convert_graph_layout(mod, desired_layouts, ops=None):
      """Alter the layout of the input graph.
  
      Parameters
      ----------
      mod : tvm.IRModule
          The relay module to convert.
      desired_layouts : list[str]
          The layouts to convert to.
          Expects either a single element or one str per operator.
          Can be only data layouts or combination of both, e.g. NHWC:HWIO
      ops : list
          List of operators to be layout converted.
  
      Returns
      -------
      mod : tvm.IRModule
          The converted module.
      """
      if ops is None:
          ops = ["nn.conv2d", "nn.conv2d_transpose", "qnn.conv2d"]
  
      if not isinstance(desired_layouts, list):
          # For backwards compatibility
          assert isinstance(desired_layouts, str)
          desired_layouts = [desired_layouts]
  
      if len(desired_layouts) != len(ops):
          if len(desired_layouts) != 1:
              raise TVMCException(
                  "Expected 1 or {} layouts but got {}".format(
                      len(ops), len(desired_layouts)
                  )
              )
          desired_layouts = desired_layouts * len(ops)
  
      def layout_helper(layout):
          if ":" in layout:
              data_layout, kernel_layout = layout.split(":", 1)
          else:
              data_layout = layout
              kernel_layout = "default"
          return [data_layout, kernel_layout]
  
      desired_layouts = {
          op: layout_helper(desired_layouts[i])
          for i, op in enumerate(ops)
      }
  
      # Convert the layout of the graph where possible.
      seq = transform.Sequential(
          [
              relay.transform.RemoveUnusedFunctions(),
              relay.transform.ConvertLayout(desired_layouts),
              relay.transform.FoldConstant(),
          ]
      )
  
      try:
          return seq(mod)
      except Exception as err:
          raise TVMCException(
              "Error converting layouts: {}".format(str(err))
          )
  
file_path: tvm/python/tvm/driver/tvmc/transform.py
imports: from tvm import relay, transform
  from tvm.driver.tvmc import TVMCException
label_desc: Use image node_id 3 for calling a global function with example usage: convert_graph_layout(mod, desired_layouts, ops) and returns: list, seq