code: def test_cmp_type():
      for op, ref in (
          (relay.greater, np.greater),
          (relay.greater_equal, np.greater_equal),
          (relay.less, np.less),
          (relay.less_equal, np.less_equal),
          (relay.equal, np.equal),
          (relay.not_equal, np.not_equal),
      ):
          x = relay.var("x", relay.TensorType((10, 4), "float32"))
          y = relay.var("y", relay.TensorType((5, 10, 1), "float32"))
          z = op(x, y)
          zz = run_infer_type(z)
          assert zz.checked_type == relay.TensorType((5, 10, 4), "bool")
  
          if ref is not None:
              x_shape = (10, 4)
              y_shape = (5, 10, 1)
              t1 = relay.TensorType(x_shape)
              t2 = relay.TensorType(y_shape)
              x = relay.var("x", t1)
              y = relay.var("y", t2)
              z = op(x, y)
              x_data = np.random.rand(*x_shape).astype(t1.dtype)
              y_data = np.random.rand(*y_shape).astype(t2.dtype)
              ref_res = ref(x_data, y_data)
              func = relay.Function([x, y], z)
  
              for target, dev in tvm.testing.enabled_targets():
                  op_res = relay.create_executor(
                      "graph", device=dev, target=target
                  ).evaluate(func)(x_data, y_data)
                  tvm.testing.assert_allclose(op_res.numpy(), ref_res)
  
imports: import sys
  import numpy
  import numpy.random
  import pytest
  import tvm
  import tvm.testing
  import tvm.topi.testing
  from tvm import relay, te
  from tvm.relay import transform
  from tvm.relay.testing import run_infer_type
label_desc: Use image node_id 2 for calling a global function with example usage: test_cmp_type() without return types