code: def _stride_array(array, shape, strides, storage_offset):
      """Wrapper of :func:`numpy.lib.stride_tricks.as_strided`.
  
      .. note:
          ``strides`` and ``storage_offset`` is given in the unit of steps
          instead the unit of bytes. This specification differs from that of
          :func:`numpy.lib.stride_tricks.as_strided`.
  
      Args:
          array (:class:`numpy.ndarray` of :class:`cupy.ndarray`):
              The base array for the returned view.
          shape (tuple of int):
              The shape of the returned view.
          strides (tuple of int):
              The strides of the returned view, given in the unit of steps.
          storage_offset (int):
              The offset from the leftest pointer of allocated memory to
              the first element of returned view, given in the unit of steps.
  
      Returns:
          :class:`numpy.ndarray` or :class:`cupy.ndarray`:
              The new view for the base array.
      """
  
      min_index = _min_index(shape, strides, storage_offset)
      max_index = _max_index(shape, strides, storage_offset)
  
      strides = _step2byte(strides, array.itemsize)
      (storage_offset,) = _step2byte((storage_offset,), array.itemsize)
  
      if min_index < 0:
          raise ValueError(
              "Out of buffer: too small index was specified"
          )
  
      if isinstance(array, cuda.ndarray):
          pooled_memory = array.data.mem
          if (max_index + 1) * array.itemsize > pooled_memory.size:
              raise ValueError(
                  "Out of buffer: too large index was specified"
              )
  
          memptr = cuda.cupy.cuda.memory.MemoryPointer(
              pooled_memory, storage_offset
          )
          return cuda.cupy.ndarray(shape, array.dtype, memptr, strides)
      elif isinstance(array, np.ndarray):
          base_array = _get_base_array(array)
          if (max_index + 1) * base_array.itemsize > base_array.nbytes:
              raise ValueError(
                  "Out of buffer: too large index was specified"
              )
  
          return np.ndarray(
              shape,
              base_array.dtype,
              base_array.data,
              storage_offset,
              strides,
          )
      else:
          raise TypeError("Only (np|cp).ndarray is accepted")
  
imports: import numpy
  import six
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer.utils import type_check
label_desc: Use image node_id 8 for calling a global function with example usage: _stride_array(array, shape, strides, storage_offset) and returns: cuda, np