code: def test_custom_op_rel_infer():
      """Tests infer type for custom_op"""
  
      def custom_log1_rel(arg_types, attrs):
          assert (
              len(arg_types) == 1
          ), "type relation arg number mismatch!"
          if attrs:
              assert isinstance(attrs, DictAttrs)
          inputa_type = arg_types[0]
          return relay.TensorType(inputa_type.shape, inputa_type.dtype)
  
      op_name = "custom_log1"
      _op.register(op_name, r"code(cal log of a tensor.)code")
      _op.get(op_name).set_num_inputs(1)
      _op.get(op_name).add_argument(
          "data_0", "Tensor", "The input data tensor."
      )
      _op.get(op_name).set_attrs_type_key("DictAttrs")
      # call customized relation functions
      _op.get(op_name).add_type_rel("custom_log1", custom_log1_rel)
      _op.get(op_name).set_support_level(1)
      _op.register_pattern(op_name, _op.OpPattern.ELEMWISE)
      _op.register_stateful(op_name, False)
  
      def clog(x):
          return relay.Call(_op.get(op_name), [x])
  
      tp = relay.TensorType((10, 10), "float32")
      x = relay.var("x", tp)
      sb = relay.ScopeBuilder()
      t1 = sb.let("t1", clog(x))
      t2 = sb.let("t2", relay.add(t1, x))
      sb.ret(t2)
      f = relay.Function([x], sb.get())
      fchecked = infer_expr(f)
      assert fchecked.checked_type == relay.FuncType([tp], tp)
  
imports: import pytest
  import tvm
  from tvm import IRModule, parser, relay, te
  from tvm.relay import analysis, op, transform
  from tvm.relay.op import op
  import numpy
label_desc: Use image node_id 30 for calling a global function with example usage: test_custom_op_rel_infer() and returns: relay, relay