code: def _as_noncontiguous_array(array):
      # This is a temporary function used by tests to convert contiguous arrays
      # to non-contiguous arrays.
      #
      # This functions can be removed if e.g. BackendConfig starts supporting
      # contiguousness configurations and the array conversion method takes that
      # into account. Note that that would also mean rewriting tests to use the
      # backend injector in the first place.
  
      def as_noncontiguous_array(a):
          if a is None:
              return None
  
          if a.size <= 1:
              return a
  
          device = backend.get_device_from_array(a)
          xp = device.xp
          slices = (slice(None, None, -2),) * a.ndim
          with chainer.using_device(device):
              ret = xp.empty(
                  tuple([s * 2 for s in a.shape]), dtype=a.dtype
              )
              ret[slices] = a
              ret = ret[slices]
          if device.xp is chainerx:
              assert not ret.is_contiguous
          else:
              assert not ret.flags.c_contiguous
  
          return ret
  
      if isinstance(array, (list, tuple)):
          return type(array)(
              [_as_noncontiguous_array(arr) for arr in array]
          )
      else:
          return as_noncontiguous_array(array)
  
file_path: chainer/chainer/testing/array.py
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer import utils
  import chainerx
label_desc: Use image node_id 2 for calling a global function with example usage: _as_noncontiguous_array(array) and returns: ret, type, as_noncontiguous_array, None, a