code: def test_layout_transform_fold_constant(relay_conv2d):
      """
      Test layout is correctly transformed and constant folding is applied.
      """
      desired_layout = "NHWC"
  
      @pass_instrument
      class CollectPassNames:
          def __init__(self):
              self.names = []
  
          def run_after_pass(self, _, info):
              self.names.append(info.name)
  
      pass_names = CollectPassNames()
      with tvm.transform.PassContext(
          opt_level=3, instruments=[pass_names]
      ):
          apply_graph_transforms(
              relay_conv2d, {"desired_layout": [desired_layout]}
          )
  
      names = pass_names.names
      assert "ConvertLayout" in names
      assert "FoldConstant" in names
      assert names.index("ConvertLayout") < names.index("FoldConstant")
  
file_path: tvm/tests/python/driver/tvmc/test_transform.py
imports: import pytest
  from unittest.mock import MagicMock
  import tvm
  from tvm import relay
  from tvm.relay import testing
  from tvm.relay.expr_functor import ExprMutator
  from tvm.ir.instrument import pass_instrument
  from tvm.driver.tvmc.transform import apply_graph_transforms
  from tvm.driver.tvmc.model import TVMCException
label_desc: Use image node_id 1 for calling a global function with example usage: test_layout_transform_fold_constant(relay_conv2d) without return types