code: def test_simplify_reshape():
      def before():
          x = relay.var("x", shape=(1, 16, 16, 16), dtype="float32")
          w = relay.var("w", shape=(32, 16, 3, 3), dtype="float32")
          y = relay.nn.conv2d(x, w, padding=(1, 1))
          y = relay.reshape(y, newshape=(1, 16, -1))
          y = relay.reshape(y, newshape=(4, 8, -1, 16))
          y = relay.reverse_reshape(y, newshape=(32, 0, -1))
          return relay.Function([x, w], y)
  
      def expected():
          x = relay.var("x", shape=(1, 16, 16, 16), dtype="float32")
          w = relay.var("w", shape=(32, 16, 3, 3), dtype="float32")
          y = relay.nn.conv2d(x, w, padding=(1, 1))
          y = relay.reshape(y, newshape=(32, 16, 16))
          return relay.Function([x, w], y)
  
      def symbolic():
          b = tvm.te.size_var("b")
          x = relay.var("x", shape=(b, 16, 16, 16), dtype="float32")
          w = relay.var("w", shape=(32, 16, 3, 3), dtype="float32")
          y = relay.nn.conv2d(x, w, padding=(1, 1))
          y = relay.reshape(y, newshape=(1, 16, -1))
          y = relay.reshape(y, newshape=(4, 8, -1, 16))
          y = relay.reverse_reshape(y, newshape=(32, 0, -1))
          return relay.Function([x, w], y)
  
      z = before()
      zz = run_opt_pass(z, transform.SimplifyExpr())
      after = run_opt_pass(expected(), transform.InferType())
      assert tvm.ir.structural_equal(zz, after)
  
      z = symbolic()
      zz = run_opt_pass(z, transform.SimplifyExpr())
      after = run_opt_pass(symbolic(), transform.InferType())
      assert tvm.ir.structural_equal(zz, after)
  
imports: from math import sqrt
  import pytest
  import tvm
  from tvm import relay
  from tvm.relay import transform
  from tvm.relay.testing import run_opt_pass, run_infer_type
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: test_simplify_reshape() and returns: relay, relay, relay