code: def test_logical_binary_ele():
      def test_apply(
          func,
          name,
          f_numpy,
          lhs,
          rhs,
          dtype="bool",
      ):
          # Build the logic and compile the function
          A = te.var("A", dtype=dtype)
          B = te.var("B", dtype=dtype)
          C = func(A, B)
          if isinstance(A, tvm.tir.PrimExpr) and isinstance(
              B, tvm.tir.PrimExpr
          ):
              assert isinstance(C, tvm.tir.PrimExpr)
              return
  
          def check_target(target, dev):
              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=name)
  
              lhs_nd = tvm.nd.array(lhs, dev)
              rhs_nd = tvm.nd.array(rhs, dev)
  
              out_npy = f_numpy(lhs, rhs)
              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, dev)
  
      test_apply(
          topi.logical_and, "logical_and", np.logical_and, True, False
      )
      test_apply(
          topi.logical_and,
          "logical_and",
          np.logical_and,
          [True, False],
          [False, False],
      )
      test_apply(
          topi.logical_or, "logical_or", np.logical_or, True, False
      )
      test_apply(
          topi.logical_or,
          "logical_or",
          np.logical_or,
          [True, False],
          [False, False],
      )
      test_apply(
          topi.logical_xor, "logical_xor", np.logical_xor, True, False
      )
      test_apply(
          topi.logical_xor,
          "logical_xor",
          np.logical_xor,
          [True, False],
          [False, False],
      )
  
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 17 for calling a global function with example usage: test_logical_binary_ele() without return types