code: def test_eliminate_identity():
      def check(x, y=None, do_nothing=False):
          expected = run_infer_type(x)
          if do_nothing:
              actual = run_opt_pass(x, transform.SimplifyExpr())
              assert tvm.ir.structural_equal(actual, expected)
          else:
              assert y is not None
              actual = run_opt_pass(y, transform.SimplifyExpr())
              assert tvm.ir.structural_equal(actual, expected)
  
      shape = [2, 3, 4]
      dtype = "float32"
      x = relay.var("x", shape=shape, dtype=dtype)
      x = run_opt_pass(x, transform.InferType())
  
      for op, op_like, id_op, const in [
          (
              relay.zeros,
              relay.zeros_like,
              relay.add,
              relay.const(0, dtype),
          ),
          (
              relay.ones,
              relay.ones_like,
              relay.multiply,
              relay.const(1, dtype),
          ),
      ]:
          check(x, id_op(op_like(x), x))
          check(x, id_op(op(shape, dtype), x))
          check(x, id_op(const, x))
          check(x, id_op(op(shape[1:], dtype), x))
          check(x, id_op(x, op_like(x)))
          check(x, id_op(x, op(shape, dtype)))
          check(x, id_op(x, const))
          check(x, id_op(x, op(shape[1:], dtype)))
          check(id_op(x, op([2] + shape, dtype)), do_nothing=True)
          check(id_op(op([2] + shape, dtype), x), do_nothing=True)
  
      for op, op_like, id_op, const in [
          (
              relay.zeros,
              relay.zeros_like,
              relay.subtract,
              relay.const(0, dtype),
          ),
          (
              relay.ones,
              relay.ones_like,
              relay.divide,
              relay.const(1, dtype),
          ),
      ]:
          check(x, id_op(x, op_like(x)))
          check(x, id_op(x, const))
          check(x, id_op(x, op(shape, dtype)))
          check(x, id_op(x, op(shape[1:], dtype)))
          check(id_op(x, op([2] + shape, dtype)), do_nothing=True)
          check(id_op(const, x), id_op(op(shape, dtype), x))
          check(id_op(const, x), id_op(op_like(x), x))
  
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 4 for calling a global function with example usage: test_eliminate_identity() without return types