code: def verify_reinterpret(in_shape, in_dtype, out_dtype, generator):
      A = te.placeholder(shape=in_shape, name="A", dtype=in_dtype)
      B = topi.reinterpret(A, out_dtype)
  
      def check_device(target, dev):
          if (
              in_dtype == "float16"
              and target == "cuda"
              and not have_fp16(dev.compute_version)
          ):
              print(
                  "Skip because %s does not have fp16 support" % target
              )
              return
          print("Running on target: %s" % target)
          with tvm.target.Target(target):
              s = tvm.topi.testing.get_elemwise_schedule(target)(B)
          foo = tvm.build(s, [A, B], target, name="reinterpret")
          data_npy = generator(in_shape).astype(in_dtype)
          out_npy = data_npy.view(B.dtype)
          data_nd = tvm.nd.array(data_npy, dev)
          out_nd = tvm.nd.array(np.empty(in_shape).astype(B.dtype), dev)
          foo(data_nd, out_nd)
          np.testing.assert_equal(out_nd.numpy(), out_npy)
  
      for target, dev in tvm.testing.enabled_targets():
          check_device(target, dev)
  
imports: import numpy
  import pytest
  import tvm
  from tvm import te
  from tvm import topi
  from tvm import relay
  import tvm.topi.testing
  from tvm.contrib.nvcc import have_fp16
  import tvm.testing
label_desc: Use image node_id 2 for calling a global function with example usage: verify_reinterpret(in_shape, in_dtype, out_dtype, generator) without return types