prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `cupy.array_split` doesn't accept empty indecies
  ```
  >>> x=cupy.array([1])
  >>> cupy.array_split(x, [])
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/unno/git/chainer/cupy/manipulation/split.py", line 32, in array_split
      ret.append(ary[skip + (slice(index, size),)])
  UnboundLocalError: local variable 'index' referenced before assignment
  ```
  
  
  </issue>
  <code>
  [start of cupy/manipulation/split.py]
  1 import numpy
  2 import six
  3 
  4 
  5 def array_split(ary, indices_or_sections, axis=0):
  6     """Splits an array into multiple sub arrays along a given axis.
  7 
  8     This function is almost equivalent to :func:`cupy.split`. The only
  9     difference is that this function allows an integer sections that does not
  10     evenly divide the axis.
  11 
  12     .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.array_split`
  13 
  14     """
  15     if ary.ndim <= axis:
  16         raise IndexError('Axis exceeds ndim')
  17     size = ary.shape[axis]
  18 
  19     if numpy.isscalar(indices_or_sections):
  20         each_size = (size - 1) // indices_or_sections + 1
  21         indices = [i * each_size
  22                    for i in six.moves.range(1, indices_or_sections)]
  23     else:
  24         indices = indices_or_sections
  25 
  26     skip = (slice(None),) * axis
  27     ret = []
  28     i = 0
  29     for index in indices:
  30         ret.append(ary[skip + (slice(i, index),)])
  31         i = index
  32     ret.append(ary[skip + (slice(index, size),)])
  33 
  34     return ret
  35 
  36 
  37 def dsplit(ary, indices_or_sections):
  38     """Splits an array into multiple sub arrays along the third axis.
  39 
  40     This is equivalent to ``split`` with ``axis=2``.
  41 
  42     .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.dsplit`
  43 
  44     """
  45     if ary.ndim <= 2:
  46         raise ValueError('Cannot dsplit an array with less than 3 dimensions')
  47     return split(ary, indices_or_sections, 2)
  48 
  49 
  50 def hsplit(ary, indices_or_sections):
  51     """Splits an array into multiple sub arrays horizontally.
  52 
  53     This is equivalent to ``split`` with ``axis=0`` if ``ary`` has one
  54     dimension, and otherwise that with ``axis=1``.
  55 
  56     .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.hsplit`
  57 
  58     """
  59     if ary.ndim == 0:
  60         raise ValueError('Cannot hsplit a zero-dimensional array')
  61     if ary.ndim == 1:
  62         return split(ary, indices_or_sections, 0)
  63     else:
  64         return split(ary, indices_or_sections, 1)
  65 
  66 
  67 def split(ary, indices_or_sections, axis=0):
  68     """Splits an array into multiple sub arrays along a given axis.
  69 
  70     Args:
  71         ary (cupy.ndarray): Array to split.
  72         indices_or_sections (int or sequence of ints): A value indicating how
  73             to divide the axis. If it is an integer, then is treated as the
  74             number of sections, and the axis is evenly divided. Otherwise,
  75             the integers indicate indices to split at. Note that the sequence
  76             on the device memory is not allowed.
  77         axis (int): Axis along which the array is split.
  78 
  79     Returns:
  80         A list of sub arrays. Eacy array is a view of the corresponding input
  81         array.
  82 
  83     .. seealso:: :func:`numpy.split`
  84 
  85     """
  86     if ary.ndim <= axis:
  87         raise IndexError('Axis exceeds ndim')
  88     size = ary.shape[axis]
  89 
  90     if numpy.isscalar(indices_or_sections):
  91         if size % indices_or_sections != 0:
  92             raise ValueError(
  93                 'indices_or_sections must divide the size along the axes.\n'
  94                 'If you want to split the array into non-equally-sized '
  95                 'arrays, use array_split instead.')
  96     return array_split(ary, indices_or_sections, axis)
  97 
  98 
  99 def vsplit(ary, indices_or_sections):
  100     """Splits an array into multiple sub arrays along the first axis.
  101 
  102     This is equivalent to ``split`` with ``axis=0``.
  103 
  104     .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.dsplit`
  105 
  106     """
  107     if ary.ndim <= 1:
  108         raise ValueError('Cannot vsplit an array with less than 2 dimensions')
  109     return split(ary, indices_or_sections, 0)
  110
  [end of cupy/manipulation/split.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/cupy/manipulation/split.py b/cupy/manipulation/split.py
  --- a/cupy/manipulation/split.py
  +++ b/cupy/manipulation/split.py
  @@ -23,6 +23,9 @@
       else:
           indices = indices_or_sections
   
  +    if len(indices) == 0:
  +        return [ary]
  +
       skip = (slice(None),) * axis
       ret = []
       i = 0
  
verification_info: {"golden_diff": "diff --git a/cupy/manipulation/split.py b/cupy/manipulation/split.py\n--- a/cupy/manipulation/split.py\n+++ b/cupy/manipulation/split.py\n@@ -23,6 +23,9 @@\n     else:\n         indices = indices_or_sections\n \n+    if len(indices) == 0:\n+        return [ary]\n+\n     skip = (slice(None),) * axis\n     ret = []\n     i = 0\n", "issue": "`cupy.array_split` doesn't accept empty indecies\n```\n>>> x=cupy.array([1])\n>>> cupy.array_split(x, [])\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"/home/unno/git/chainer/cupy/manipulation/split.py\", line 32, in array_split\n    ret.append(ary[skip + (slice(index, size),)])\nUnboundLocalError: local variable 'index' referenced before assignment\n```\n\n", "before_files": [{"content": "import numpy\nimport six\n\n\ndef array_split(ary, indices_or_sections, axis=0):\n    \"\"\"Splits an array into multiple sub arrays along a given axis.\n\n    This function is almost equivalent to :func:`cupy.split`. The only\n    difference is that this function allows an integer sections that does not\n    evenly divide the axis.\n\n    .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.array_split`\n\n    \"\"\"\n    if ary.ndim <= axis:\n        raise IndexError('Axis exceeds ndim')\n    size = ary.shape[axis]\n\n    if numpy.isscalar(indices_or_sections):\n        each_size = (size - 1) // indices_or_sections + 1\n        indices = [i * each_size\n                   for i in six.moves.range(1, indices_or_sections)]\n    else:\n        indices = indices_or_sections\n\n    skip = (slice(None),) * axis\n    ret = []\n    i = 0\n    for index in indices:\n        ret.append(ary[skip + (slice(i, index),)])\n        i = index\n    ret.append(ary[skip + (slice(index, size),)])\n\n    return ret\n\n\ndef dsplit(ary, indices_or_sections):\n    \"\"\"Splits an array into multiple sub arrays along the third axis.\n\n    This is equivalent to ``split`` with ``axis=2``.\n\n    .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.dsplit`\n\n    \"\"\"\n    if ary.ndim <= 2:\n        raise ValueError('Cannot dsplit an array with less than 3 dimensions')\n    return split(ary, indices_or_sections, 2)\n\n\ndef hsplit(ary, indices_or_sections):\n    \"\"\"Splits an array into multiple sub arrays horizontally.\n\n    This is equivalent to ``split`` with ``axis=0`` if ``ary`` has one\n    dimension, and otherwise that with ``axis=1``.\n\n    .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.hsplit`\n\n    \"\"\"\n    if ary.ndim == 0:\n        raise ValueError('Cannot hsplit a zero-dimensional array')\n    if ary.ndim == 1:\n        return split(ary, indices_or_sections, 0)\n    else:\n        return split(ary, indices_or_sections, 1)\n\n\ndef split(ary, indices_or_sections, axis=0):\n    \"\"\"Splits an array into multiple sub arrays along a given axis.\n\n    Args:\n        ary (cupy.ndarray): Array to split.\n        indices_or_sections (int or sequence of ints): A value indicating how\n            to divide the axis. If it is an integer, then is treated as the\n            number of sections, and the axis is evenly divided. Otherwise,\n            the integers indicate indices to split at. Note that the sequence\n            on the device memory is not allowed.\n        axis (int): Axis along which the array is split.\n\n    Returns:\n        A list of sub arrays. Eacy array is a view of the corresponding input\n        array.\n\n    .. seealso:: :func:`numpy.split`\n\n    \"\"\"\n    if ary.ndim <= axis:\n        raise IndexError('Axis exceeds ndim')\n    size = ary.shape[axis]\n\n    if numpy.isscalar(indices_or_sections):\n        if size % indices_or_sections != 0:\n            raise ValueError(\n                'indices_or_sections must divide the size along the axes.\\n'\n                'If you want to split the array into non-equally-sized '\n                'arrays, use array_split instead.')\n    return array_split(ary, indices_or_sections, axis)\n\n\ndef vsplit(ary, indices_or_sections):\n    \"\"\"Splits an array into multiple sub arrays along the first axis.\n\n    This is equivalent to ``split`` with ``axis=0``.\n\n    .. seealso:: :func:`cupy.split` for more detail, :func:`numpy.dsplit`\n\n    \"\"\"\n    if ary.ndim <= 1:\n        raise ValueError('Cannot vsplit an array with less than 2 dimensions')\n    return split(ary, indices_or_sections, 0)\n", "path": "cupy/manipulation/split.py"}]}