code: def verify_broadcast_binary_ele(
      lhs_shape,
      rhs_shape,
      ftopi,
      fnumpy,
      lhs_min=-100,
      lhs_max=100,
      rhs_min=-100,
      rhs_max=100,
      dtype="float32",
  ):
      # Build the logic and compile the function
      A = (
          te.var("A", dtype=dtype)
          if lhs_shape is None
          else te.placeholder(shape=lhs_shape, name="A", dtype=dtype)
      )
      B = (
          te.var("B", dtype=dtype)
          if rhs_shape is None
          else te.placeholder(shape=rhs_shape, name="B", dtype=dtype)
      )
      C = ftopi(A, B)
      if isinstance(A, tvm.tir.PrimExpr) and isinstance(
          B, tvm.tir.PrimExpr
      ):
          assert isinstance(C, tvm.tir.PrimExpr)
          return
  
      def gen_operand(shape, low, high, dev):
          if shape is None:
              npy = float(np.random.uniform(low=low, high=high))
              if dtype.startswith("int"):
                  npy = int(npy)
              nd = npy
          else:
              npy = np.random.uniform(
                  low=low, high=high, size=shape
              ).astype(dtype)
              nd = tvm.nd.array(npy, dev)
          return npy, nd
  
      def check_target(target):
          dev = tvm.device(target, 0)
          if not tvm.testing.device_enabled(target):
              print("Skip because %s is not enabled" % target)
              return
          print("Running on target: %s" % target)
          with tvm.target.Target(target):
              s = tvm.topi.testing.get_broadcast_schedule(target)(C)
          foo = tvm.build(
              s,
              [A, B, C],
              target,
              name="broadcast_binary" + "_" + ftopi.__name__,
          )
  
          lhs_npy, lhs_nd = gen_operand(
              lhs_shape, lhs_min, lhs_max, dev
          )
          rhs_npy, rhs_nd = gen_operand(
              rhs_shape, rhs_min, rhs_max, dev
          )
          out_npy = fnumpy(lhs_npy, rhs_npy)
  
          out_nd = tvm.nd.array(
              np.empty(out_npy.shape).astype(C.dtype), dev
          )
          foo(lhs_nd, rhs_nd, out_nd)
          tvm.testing.assert_allclose(
              out_nd.numpy(), out_npy, rtol=1e-4, atol=1e-4
          )
  
      for target, dev in tvm.testing.enabled_targets():
          check_target(target)
      check_target("sdaccel")
  
imports: import numpy
  import tvm
  from tvm import te
  from tvm import topi
  import tvm.testing
  import tvm.topi.testing
label_desc: Use image node_id 2 for calling a global function with example usage: verify_broadcast_binary_ele(lhs_shape, rhs_shape, ftopi, fnumpy, lhs_min, lhs_max, rhs_min, rhs_max, dtype) and returns: npy,  nd