code: def test_conv_roi_align_convert_layout():
      def before():
          x = relay.var("x", shape=(1, 64, 56, 56))
          weight1 = relay.var("weight1", shape=(64, 64, 3, 3))
          y = relay.nn.conv2d(
              x,
              weight1,
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NCHW",
              kernel_layout="OIHW",
          )
          rois = relay.var("rois", shape=(32, 5))
          y = relay.vision.roi_align(
              y,
              rois,
              pooled_size=(14, 14),
              spatial_scale=0.0625,
              sample_ratio=2,
              layout="NCHW",
          )
          y = relay.Function(analysis.free_vars(y), y)
          return y
  
      def expected():
          x = relay.var("x", shape=(1, 64, 56, 56))
          weight1 = relay.var("weight1", shape=(64, 64, 3, 3))
          x = relay.layout_transform(x, "NCHW", "NHWC")
          weight1 = relay.layout_transform(weight1, "OIHW", "HWIO")
          y = relay.nn.conv2d(
              x,
              weight1,
              channels=64,
              kernel_size=(3, 3),
              padding=(1, 1),
              data_layout="NHWC",
              kernel_layout="HWIO",
          )
          rois = relay.var("rois", shape=(32, 5))
          y = relay.vision.roi_align(
              y,
              rois,
              pooled_size=(14, 14),
              spatial_scale=0.0625,
              sample_ratio=2,
              layout="NHWC",
          )
          ret = relay.layout_transform(y, "NHWC", "NCHW")
          y = relay.Function(analysis.free_vars(ret), ret)
          return y
  
      a = before()
      desired_layouts = {
          "nn.conv2d": ["NHWC", "HWIO"],
          "vision.roi_align": ["NHWC", "default"],
      }
      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 28 for calling a global function with example usage: test_conv_roi_align_convert_layout() and returns: y, y