code: def numpy_cupyx_array_equal(target_func, name="func"):
      _mod = (cupy, numpy)
  
      _numpy_funcs = {
          "empty": numpy.empty,
          "empty_like": numpy.empty_like,
          "zeros": numpy.zeros,
          "zeros_like": numpy.zeros_like,
      }
  
      _cupy_funcs = {
          "empty": cupyx.empty_pinned,
          "empty_like": cupyx.empty_like_pinned,
          "zeros": cupyx.zeros_pinned,
          "zeros_like": cupyx.zeros_like_pinned,
      }
  
      def _get_test_func(xp, func):
          if xp is numpy:
              return _numpy_funcs[func]
          elif xp is cupy:
              return _cupy_funcs[func]
          else:
              assert False
  
      def _check_pinned_mem_used(a, xp):
          if xp is cupy:
              assert isinstance(a.base, cupy.cuda.PinnedMemoryPointer)
              assert a.base.ptr == a.ctypes.data
  
      def decorator(impl):
          @_wraps_partial(impl, name)
          def test_func(self, *args, **kw):
              out = []
              for xp in _mod:
                  func = _get_test_func(xp, target_func)
                  kw[name] = func
                  a = impl(self, *args, **kw)
                  _check_pinned_mem_used(a, xp)
                  out.append(a)
              numpy.testing.assert_array_equal(*out)
  
          return test_func
  
      return decorator
  
imports: import unittest
  import numpy
  import pytest
  import cupy
  from cupy import testing
  from cupy.testing._loops import _wraps_partial
  import cupyx
label_desc: Use image node_id 1 for calling a global function with example usage: numpy_cupyx_array_equal(target_func, name) and returns: decorator, test_func, _numpy_funcs, _cupy_funcs