code: def test_percentile_memory_access(self, dtype):
      # Create an allocator that guarantees array allocated in
      # cupy.percentile call will be followed by a NaN
      original_allocator = cuda.get_allocator()
  
      def controlled_allocator(size):
          memptr = original_allocator(size)
          base_size = memptr.mem.size
          assert base_size % 512 == 0
          item_size = dtype().itemsize
          shape = (base_size // item_size,)
          x = cupy.ndarray(memptr=memptr, shape=shape, dtype=dtype)
          x.fill(cupy.nan)
          return memptr
  
      # Check that percentile still returns non-NaN results
      a = testing.shaped_random((5,), cupy, dtype)
      q = cupy.array((0, 100), dtype=dtype)
  
      cuda.set_allocator(controlled_allocator)
      try:
          percentiles = cupy.percentile(
              a, q, axis=None, method="linear"
          )
      finally:
          cuda.set_allocator(original_allocator)
  
      assert not cupy.any(cupy.isnan(percentiles))
  
imports: import warnings
  import numpy
  import pytest
  import cupy
  import cupy._core._accelerator
  from cupy import cuda
  from cupy import testing
label_desc: Use image node_id 2 for calling the TestQuantile obj's underlying member method code with example usage: obj.test_percentile_memory_access(dtype) and returns: memptr