code: def test_metal_inf_nan():
      target = "metal"
  
      def check_inf_nan(dev, n, value, dtype):
          A = te.placeholder((n,), name="A", dtype=dtype)
          inf_value = tvm.tir.const(value, dtype=dtype)
          C = te.compute((n,), lambda i: inf_value, name="C")
          prim_func = te.create_prim_func([A, C])
          sch = tvm.tir.Schedule(prim_func)
          (x,) = sch.get_loops(sch.get_block("C"))
          sch.bind(x, "threadIdx.x")
          fun = tvm.build(sch.mod, target=target)
          a = tvm.nd.empty((n,), A.dtype, dev)
          c = tvm.nd.empty((n,), A.dtype, dev)
          # Only need to test compiling here
          fun(a, c)
  
      dev = tvm.device(target, 0)
  
      check_inf_nan(dev, 1, -float("inf"), "float32")
      check_inf_nan(dev, 1, -float("inf"), "float16")
      check_inf_nan(dev, 1, float("inf"), "float32")
      check_inf_nan(dev, 1, float("inf"), "float16")
      check_inf_nan(dev, 1, float("nan"), "float32")
      check_inf_nan(dev, 1, float("nan"), "float16")
  
file_path: tvm/tests/python/codegen/test_target_codegen_metal.py
imports: import numpy
  import tvm
  import tvm.script
  import tvm.testing
  from tvm import te
  from tvm.script import tir
label_desc: Use image node_id 1 for calling a global function with example usage: test_metal_inf_nan() without return types