code: def test_multiple_ends():
      @tvm.ir.register_op_attr("nn.relu", "target.test")
      def relu(expr):  # pylint: disable=unused-variable
          return True
  
      def before():
          x = relay.var("x", shape=(10, 10))
          r = relay.nn.relu(x)
          a_1 = relay.abs(r)
          a_2 = relay.abs(r)
          out = relay.add(a_1, a_2)
          f = relay.Function([x], out)
          mod = tvm.IRModule.from_expr(f)
          return mod
  
      def after():
          x = relay.var("x", shape=(10, 10))
          cb_1 = relay.annotation.compiler_begin(x, "test")
          r = relay.nn.relu(cb_1)
          ce_1 = relay.annotation.compiler_end(r, "test")
          ce_2 = relay.annotation.compiler_end(r, "test")
          cb_2 = relay.annotation.compiler_begin(ce_1, "default")
          cb_3 = relay.annotation.compiler_begin(ce_2, "default")
          a_1 = relay.abs(cb_2)
          a_2 = relay.abs(cb_3)
          ce_3 = relay.annotation.compiler_end(a_1, "default")
          ce_4 = relay.annotation.compiler_end(a_2, "default")
          cb_4 = relay.annotation.compiler_begin(ce_3, "default")
          cb_5 = relay.annotation.compiler_begin(ce_4, "default")
          out = relay.add(cb_4, cb_5)
          ce_6 = relay.annotation.compiler_end(out, "default")
          f = relay.Function([x], ce_6)
          mod = tvm.IRModule.from_expr(f)
          return mod
  
      for annotate_non_call_ops in [False, True]:
          result = transform.AnnotateTarget(
              "test", annotate_non_call_ops
          )(before())
          expected = transform.InferType()(after())
          assert tvm.ir.structural_equal(expected, result)
  
imports: import os
  import sys
  import numpy
  import pytest
  import tvm
  import tvm.relay.testing
  import tvm.relay.transform
  from tvm import relay
  from tvm import runtime
  from tvm.contrib import utils
label_desc: Use image node_id 4 for calling a global function with example usage: test_multiple_ends() and returns: True, mod, mod