code: def test_different_ops_convert_layout():
      """Check convert layout correctly supports converting the layout of
      different ops in the same graph.
      """
  
      def before():
          x = relay.var("x", shape=(1, 64, 56, 56))
          weight1 = relay.var("weight1", shape=(64, 3, 3, 64))
          weight2 = relay.var(
              "weight2", shape=(64, 3, 3, 64), dtype="int8"
          )
          weight3 = relay.var("weight3", shape=(64, 3, 3, 64))
          out = relay.nn.conv2d(
              x,
              weight1,
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NCHW",
              kernel_layout="OHWI",
          )
          out = relay.cast(out, "int8")
          out = relay.qnn.op.conv2d(
              out,
              weight2,
              relay.const(1, "int32"),
              relay.const(1, "int32"),
              relay.const(1, "float32"),
              relay.const(1, "float32"),
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NCHW",
              kernel_layout="OHWI",
          )
          out = relay.cast(out, "float32")
          out = relay.nn.conv2d_transpose(
              out,
              weight3,
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NCHW",
              kernel_layout="OHWI",
          )
          out = relay.Function(analysis.free_vars(out), out)
          return out
  
      def expected():
          x = relay.var("x", shape=(1, 64, 56, 56))
          weight1 = relay.var("weight1", shape=(64, 3, 3, 64))
          weight2 = relay.var(
              "weight2", shape=(64, 3, 3, 64), dtype="int8"
          )
          weight3 = relay.var("weight3", shape=(64, 3, 3, 64))
          x = relay.layout_transform(x, "NCHW", "NHWC")
          weight1 = relay.layout_transform(weight1, "OHWI", "HWIO")
          out = relay.nn.conv2d(
              x,
              weight1,
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NHWC",
              kernel_layout="HWIO",
          )
          out = relay.cast(out, "int8")
          out = relay.layout_transform(out, "NHWC", "NCHW")
          weight2 = relay.layout_transform(weight2, "OHWI", "OIHW")
          out = relay.qnn.op.conv2d(
              out,
              weight2,
              relay.const(1, "int32"),
              relay.const(1, "int32"),
              relay.const(1, "float32"),
              relay.const(1, "float32"),
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NCHW",
              kernel_layout="OIHW",
          )
          out = relay.cast(out, "float32")
          out = relay.layout_transform(out, "NCHW", "NHWC")
          weight3 = relay.layout_transform(weight3, "OHWI", "HWIO")
          out = relay.nn.conv2d_transpose(
              out,
              weight3,
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NHWC",
              kernel_layout="HWIO",
          )
          out = relay.layout_transform(out, "NHWC", "NCHW")
          out = relay.Function(analysis.free_vars(out), out)
          return out
  
      a = before()
      desired_layouts = {
          "nn.conv2d": ["NHWC", "HWIO"],
          "qnn.conv2d": ["NCHW", "OIHW"],
          "nn.conv2d_transpose": ["NHWC", "HWIO"],
      }
      a = run_opt_pass(a, transform.ConvertLayout(desired_layouts))
      b = run_opt_pass(expected(), transform.InferType())
  
      assert tvm.ir.structural_equal(a, b), "Actual = \n" + str(a)
  
imports: import pytest
  import tvm
  from tvm import relay, te
  from tvm.relay import analysis, transform
  from tvm.relay.op import op
  from tvm.relay.op import register_alter_op_layout
  from tvm.relay.quantize._annotate import attach_simulated_quantize, QAnnotateKind
  from tvm.relay.transform.infer_layout_utils import InferCorrectLayoutOutput
label_desc: Use image node_id 35 for calling a global function with example usage: test_different_ops_convert_layout() and returns: out, out