We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cupy.full does not have order parameter
Hello, 

I noticed that Cupy.full does not have an order parameter, this both exists in Numpy.full and all the other Cupy.full like functions like full_like, ones_like and zeros_like. Is there any reason for that? I'm trying to use CuPy in a project as a drop in replacement and this errors out. 

Thank you!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cupy/creation/basic.py`
Content:
```
1 import cupy
2 import numpy
3 
4 from cupy.core.core import _update_order_char, _get_strides_for_order_K
5 
6 
7 def empty(shape, dtype=float, order='C'):
8     """Returns an array without initializing the elements.
9 
10     Args:
11         shape (int or tuple of ints): Dimensionalities of the array.
12         dtype: Data type specifier.
13         order ({'C', 'F'}): Row-major (C-style) or column-major
14             (Fortran-style) order.
15 
16     Returns:
17         cupy.ndarray: A new array with elements not initialized.
18 
19     .. seealso:: :func:`numpy.empty`
20 
21     """
22     return cupy.ndarray(shape, dtype, order=order)
23 
24 
25 def _new_like_order_and_strides(a, dtype, order, shape=None):
26     """
27     Determine order and strides as in NumPy's PyArray_NewLikeArray.
28 
29     (see: numpy/core/src/multiarray/ctors.c)
30     """
31     order = order.upper()
32     if order not in ['C', 'F', 'K', 'A']:
33         raise ValueError('order not understood: {}'.format(order))
34 
35     if numpy.isscalar(shape):
36         shape = (shape,)
37 
38     # Fallback to c_contiguous if keep order and number of dimensions
39     # of new shape mismatch
40     if order == 'K' and shape is not None and len(shape) != a.ndim:
41         return 'C', None, None
42 
43     order = chr(_update_order_char(a, ord(order)))
44 
45     if order == 'K':
46         strides = _get_strides_for_order_K(a, numpy.dtype(dtype), shape)
47         order = 'C'
48         memptr = cupy.empty(a.size, dtype=dtype).data
49         return order, strides, memptr
50     else:
51         return order, None, None
52 
53 
54 def empty_like(a, dtype=None, order='K', subok=None, shape=None):
55     """Returns a new array with same shape and dtype of a given array.
56 
57     This function currently does not support ``subok`` option.
58 
59     Args:
60         a (cupy.ndarray): Base array.
61         dtype: Data type specifier. The data type of ``a`` is used by default.
62         order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the
63             result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if
64             ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the
65             layout of ``a`` as closely as possible.
66         subok: Not supported yet, must be None.
67         shape (int or tuple of ints): Overrides the shape of the result. If
68             order='K' and the number of dimensions is unchanged, will try to
69             keep order, otherwise, order='C' is implied.
70 
71 
72     Returns:
73         cupy.ndarray: A new array with same shape and dtype of ``a`` with
74         elements not initialized.
75 
76     .. seealso:: :func:`numpy.empty_like`
77 
78     """
79     if subok is not None:
80         raise TypeError('subok is not supported yet')
81     if dtype is None:
82         dtype = a.dtype
83 
84     order, strides, memptr = _new_like_order_and_strides(a, dtype, order,
85                                                          shape)
86     shape = shape if shape else a.shape
87     return cupy.ndarray(shape, dtype, memptr, strides, order)
88 
89 
90 def eye(N, M=None, k=0, dtype=float):
91     """Returns a 2-D array with ones on the diagonals and zeros elsewhere.
92 
93     Args:
94         N (int): Number of rows.
95         M (int): Number of columns. M == N by default.
96         k (int): Index of the diagonal. Zero indicates the main diagonal,
97             a positive index an upper diagonal, and a negative index a lower
98             diagonal.
99         dtype: Data type specifier.
100 
101     Returns:
102         cupy.ndarray: A 2-D array with given diagonals filled with ones and
103         zeros elsewhere.
104 
105     .. seealso:: :func:`numpy.eye`
106 
107     """
108     if M is None:
109         M = N
110     ret = zeros((N, M), dtype)
111     ret.diagonal(k)[:] = 1
112     return ret
113 
114 
115 def identity(n, dtype=float):
116     """Returns a 2-D identity array.
117 
118     It is equivalent to ``eye(n, n, dtype)``.
119 
120     Args:
121         n (int): Number of rows and columns.
122         dtype: Data type specifier.
123 
124     Returns:
125         cupy.ndarray: A 2-D identity array.
126 
127     .. seealso:: :func:`numpy.identity`
128 
129     """
130     return eye(n, dtype=dtype)
131 
132 
133 def ones(shape, dtype=float):
134     """Returns a new array of given shape and dtype, filled with ones.
135 
136     This function currently does not support ``order`` option.
137 
138     Args:
139         shape (int or tuple of ints): Dimensionalities of the array.
140         dtype: Data type specifier.
141 
142     Returns:
143         cupy.ndarray: An array filled with ones.
144 
145     .. seealso:: :func:`numpy.ones`
146 
147     """
148     # TODO(beam2d): Support ordering option
149     a = cupy.ndarray(shape, dtype)
150     a.fill(1)
151     return a
152 
153 
154 def ones_like(a, dtype=None, order='K', subok=None, shape=None):
155     """Returns an array of ones with same shape and dtype as a given array.
156 
157     This function currently does not support ``subok`` option.
158 
159     Args:
160         a (cupy.ndarray): Base array.
161         dtype: Data type specifier. The dtype of ``a`` is used by default.
162         order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the
163             result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if
164             ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the
165             layout of ``a`` as closely as possible.
166         subok: Not supported yet, must be None.
167         shape (int or tuple of ints): Overrides the shape of the result. If
168             order='K' and the number of dimensions is unchanged, will try to
169             keep order, otherwise, order='C' is implied.
170 
171     Returns:
172         cupy.ndarray: An array filled with ones.
173 
174     .. seealso:: :func:`numpy.ones_like`
175 
176     """
177     if subok is not None:
178         raise TypeError('subok is not supported yet')
179     if dtype is None:
180         dtype = a.dtype
181 
182     order, strides, memptr = _new_like_order_and_strides(a, dtype, order,
183                                                          shape)
184     shape = shape if shape else a.shape
185     a = cupy.ndarray(shape, dtype, memptr, strides, order)
186     a.fill(1)
187     return a
188 
189 
190 def zeros(shape, dtype=float, order='C'):
191     """Returns a new array of given shape and dtype, filled with zeros.
192 
193     Args:
194         shape (int or tuple of ints): Dimensionalities of the array.
195         dtype: Data type specifier.
196         order ({'C', 'F'}): Row-major (C-style) or column-major
197             (Fortran-style) order.
198 
199     Returns:
200         cupy.ndarray: An array filled with zeros.
201 
202     .. seealso:: :func:`numpy.zeros`
203 
204     """
205     a = cupy.ndarray(shape, dtype, order=order)
206     a.data.memset_async(0, a.nbytes)
207     return a
208 
209 
210 def zeros_like(a, dtype=None, order='K', subok=None, shape=None):
211     """Returns an array of zeros with same shape and dtype as a given array.
212 
213     This function currently does not support ``subok`` option.
214 
215     Args:
216         a (cupy.ndarray): Base array.
217         dtype: Data type specifier. The dtype of ``a`` is used by default.
218         order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the
219             result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if
220             ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the
221             layout of ``a`` as closely as possible.
222         subok: Not supported yet, must be None.
223         shape (int or tuple of ints): Overrides the shape of the result. If
224             order='K' and the number of dimensions is unchanged, will try to
225             keep order, otherwise, order='C' is implied.
226 
227     Returns:
228         cupy.ndarray: An array filled with zeros.
229 
230     .. seealso:: :func:`numpy.zeros_like`
231 
232     """
233     if subok is not None:
234         raise TypeError('subok is not supported yet')
235     if dtype is None:
236         dtype = a.dtype
237 
238     order, strides, memptr = _new_like_order_and_strides(a, dtype, order,
239                                                          shape)
240     shape = shape if shape else a.shape
241     a = cupy.ndarray(shape, dtype, memptr, strides, order)
242     a.data.memset_async(0, a.nbytes)
243     return a
244 
245 
246 def full(shape, fill_value, dtype=None):
247     """Returns a new array of given shape and dtype, filled with a given value.
248 
249     This function currently does not support ``order`` option.
250 
251     Args:
252         shape (int or tuple of ints): Dimensionalities of the array.
253         fill_value: A scalar value to fill a new array.
254         dtype: Data type specifier.
255 
256     Returns:
257         cupy.ndarray: An array filled with ``fill_value``.
258 
259     .. seealso:: :func:`numpy.full`
260 
261     """
262     # TODO(beam2d): Support ordering option
263     if dtype is None:
264         if isinstance(fill_value, cupy.ndarray):
265             dtype = fill_value.dtype
266         else:
267             dtype = numpy.array(fill_value).dtype
268     a = cupy.ndarray(shape, dtype)
269     a.fill(fill_value)
270     return a
271 
272 
273 def full_like(a, fill_value, dtype=None, order='K', subok=None, shape=None):
274     """Returns a full array with same shape and dtype as a given array.
275 
276     This function currently does not support ``subok`` option.
277 
278     Args:
279         a (cupy.ndarray): Base array.
280         fill_value: A scalar value to fill a new array.
281         dtype: Data type specifier. The dtype of ``a`` is used by default.
282         order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the
283             result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if
284             ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the
285             layout of ``a`` as closely as possible.
286         subok: Not supported yet, must be None.
287         shape (int or tuple of ints): Overrides the shape of the result. If
288             order='K' and the number of dimensions is unchanged, will try to
289             keep order, otherwise, order='C' is implied.
290 
291     Returns:
292         cupy.ndarray: An array filled with ``fill_value``.
293 
294     .. seealso:: :func:`numpy.full_like`
295 
296     """
297     if subok is not None:
298         raise TypeError('subok is not supported yet')
299     if dtype is None:
300         dtype = a.dtype
301 
302     order, strides, memptr = _new_like_order_and_strides(a, dtype, order,
303                                                          shape)
304     shape = shape if shape else a.shape
305     a = cupy.ndarray(shape, dtype, memptr, strides, order)
306     a.fill(fill_value)
307     return a
308
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cupy/creation/basic.py b/cupy/creation/basic.py
--- a/cupy/creation/basic.py
+++ b/cupy/creation/basic.py
@@ -87,7 +87,7 @@
     return cupy.ndarray(shape, dtype, memptr, strides, order)
 
 
-def eye(N, M=None, k=0, dtype=float):
+def eye(N, M=None, k=0, dtype=float, order='C'):
     """Returns a 2-D array with ones on the diagonals and zeros elsewhere.
 
     Args:
@@ -97,6 +97,8 @@
             a positive index an upper diagonal, and a negative index a lower
             diagonal.
         dtype: Data type specifier.
+        order ({'C', 'F'}): Row-major (C-style) or column-major
+            (Fortran-style) order.
 
     Returns:
         cupy.ndarray: A 2-D array with given diagonals filled with ones and
@@ -107,7 +109,7 @@
     """
     if M is None:
         M = N
-    ret = zeros((N, M), dtype)
+    ret = zeros((N, M), dtype, order=order)
     ret.diagonal(k)[:] = 1
     return ret
 
@@ -130,7 +132,7 @@
     return eye(n, dtype=dtype)
 
 
-def ones(shape, dtype=float):
+def ones(shape, dtype=float, order='C'):
     """Returns a new array of given shape and dtype, filled with ones.
 
     This function currently does not support ``order`` option.
@@ -138,6 +140,8 @@
     Args:
         shape (int or tuple of ints): Dimensionalities of the array.
         dtype: Data type specifier.
+        order ({'C', 'F'}): Row-major (C-style) or column-major
+            (Fortran-style) order.
 
     Returns:
         cupy.ndarray: An array filled with ones.
@@ -145,8 +149,7 @@
     .. seealso:: :func:`numpy.ones`
 
     """
-    # TODO(beam2d): Support ordering option
-    a = cupy.ndarray(shape, dtype)
+    a = cupy.ndarray(shape, dtype, order=order)
     a.fill(1)
     return a
 
@@ -243,7 +246,7 @@
     return a
 
 
-def full(shape, fill_value, dtype=None):
+def full(shape, fill_value, dtype=None, order='C'):
     """Returns a new array of given shape and dtype, filled with a given value.
 
     This function currently does not support ``order`` option.
@@ -252,6 +255,8 @@
         shape (int or tuple of ints): Dimensionalities of the array.
         fill_value: A scalar value to fill a new array.
         dtype: Data type specifier.
+        order ({'C', 'F'}): Row-major (C-style) or column-major
+            (Fortran-style) order.
 
     Returns:
         cupy.ndarray: An array filled with ``fill_value``.
@@ -259,13 +264,12 @@
     .. seealso:: :func:`numpy.full`
 
     """
-    # TODO(beam2d): Support ordering option
     if dtype is None:
         if isinstance(fill_value, cupy.ndarray):
             dtype = fill_value.dtype
         else:
             dtype = numpy.array(fill_value).dtype
-    a = cupy.ndarray(shape, dtype)
+    a = cupy.ndarray(shape, dtype, order=order)
     a.fill(fill_value)
     return a

{"golden_diff": "diff --git a/cupy/creation/basic.py b/cupy/creation/basic.py\n--- a/cupy/creation/basic.py\n+++ b/cupy/creation/basic.py\n@@ -87,7 +87,7 @@\n     return cupy.ndarray(shape, dtype, memptr, strides, order)\n \n \n-def eye(N, M=None, k=0, dtype=float):\n+def eye(N, M=None, k=0, dtype=float, order='C'):\n     \"\"\"Returns a 2-D array with ones on the diagonals and zeros elsewhere.\n \n     Args:\n@@ -97,6 +97,8 @@\n             a positive index an upper diagonal, and a negative index a lower\n             diagonal.\n         dtype: Data type specifier.\n+        order ({'C', 'F'}): Row-major (C-style) or column-major\n+            (Fortran-style) order.\n \n     Returns:\n         cupy.ndarray: A 2-D array with given diagonals filled with ones and\n@@ -107,7 +109,7 @@\n     \"\"\"\n     if M is None:\n         M = N\n-    ret = zeros((N, M), dtype)\n+    ret = zeros((N, M), dtype, order=order)\n     ret.diagonal(k)[:] = 1\n     return ret\n \n@@ -130,7 +132,7 @@\n     return eye(n, dtype=dtype)\n \n \n-def ones(shape, dtype=float):\n+def ones(shape, dtype=float, order='C'):\n     \"\"\"Returns a new array of given shape and dtype, filled with ones.\n \n     This function currently does not support ``order`` option.\n@@ -138,6 +140,8 @@\n     Args:\n         shape (int or tuple of ints): Dimensionalities of the array.\n         dtype: Data type specifier.\n+        order ({'C', 'F'}): Row-major (C-style) or column-major\n+            (Fortran-style) order.\n \n     Returns:\n         cupy.ndarray: An array filled with ones.\n@@ -145,8 +149,7 @@\n     .. seealso:: :func:`numpy.ones`\n \n     \"\"\"\n-    # TODO(beam2d): Support ordering option\n-    a = cupy.ndarray(shape, dtype)\n+    a = cupy.ndarray(shape, dtype, order=order)\n     a.fill(1)\n     return a\n \n@@ -243,7 +246,7 @@\n     return a\n \n \n-def full(shape, fill_value, dtype=None):\n+def full(shape, fill_value, dtype=None, order='C'):\n     \"\"\"Returns a new array of given shape and dtype, filled with a given value.\n \n     This function currently does not support ``order`` option.\n@@ -252,6 +255,8 @@\n         shape (int or tuple of ints): Dimensionalities of the array.\n         fill_value: A scalar value to fill a new array.\n         dtype: Data type specifier.\n+        order ({'C', 'F'}): Row-major (C-style) or column-major\n+            (Fortran-style) order.\n \n     Returns:\n         cupy.ndarray: An array filled with ``fill_value``.\n@@ -259,13 +264,12 @@\n     .. seealso:: :func:`numpy.full`\n \n     \"\"\"\n-    # TODO(beam2d): Support ordering option\n     if dtype is None:\n         if isinstance(fill_value, cupy.ndarray):\n             dtype = fill_value.dtype\n         else:\n             dtype = numpy.array(fill_value).dtype\n-    a = cupy.ndarray(shape, dtype)\n+    a = cupy.ndarray(shape, dtype, order=order)\n     a.fill(fill_value)\n     return a\n", "issue": "Cupy.full does not have order parameter\nHello, \r\n\r\nI noticed that Cupy.full does not have an order parameter, this both exists in Numpy.full and all the other Cupy.full like functions like full_like, ones_like and zeros_like. Is there any reason for that? I'm trying to use CuPy in a project as a drop in replacement and this errors out. \r\n\r\nThank you!\n", "before_files": [{"content": "import cupy\nimport numpy\n\nfrom cupy.core.core import _update_order_char, _get_strides_for_order_K\n\n\ndef empty(shape, dtype=float, order='C'):\n    \"\"\"Returns an array without initializing the elements.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: A new array with elements not initialized.\n\n    .. seealso:: :func:`numpy.empty`\n\n    \"\"\"\n    return cupy.ndarray(shape, dtype, order=order)\n\n\ndef _new_like_order_and_strides(a, dtype, order, shape=None):\n    \"\"\"\n    Determine order and strides as in NumPy's PyArray_NewLikeArray.\n\n    (see: numpy/core/src/multiarray/ctors.c)\n    \"\"\"\n    order = order.upper()\n    if order not in ['C', 'F', 'K', 'A']:\n        raise ValueError('order not understood: {}'.format(order))\n\n    if numpy.isscalar(shape):\n        shape = (shape,)\n\n    # Fallback to c_contiguous if keep order and number of dimensions\n    # of new shape mismatch\n    if order == 'K' and shape is not None and len(shape) != a.ndim:\n        return 'C', None, None\n\n    order = chr(_update_order_char(a, ord(order)))\n\n    if order == 'K':\n        strides = _get_strides_for_order_K(a, numpy.dtype(dtype), shape)\n        order = 'C'\n        memptr = cupy.empty(a.size, dtype=dtype).data\n        return order, strides, memptr\n    else:\n        return order, None, None\n\n\ndef empty_like(a, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns a new array with same shape and dtype of a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        dtype: Data type specifier. The data type of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n\n    Returns:\n        cupy.ndarray: A new array with same shape and dtype of ``a`` with\n        elements not initialized.\n\n    .. seealso:: :func:`numpy.empty_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    return cupy.ndarray(shape, dtype, memptr, strides, order)\n\n\ndef eye(N, M=None, k=0, dtype=float):\n    \"\"\"Returns a 2-D array with ones on the diagonals and zeros elsewhere.\n\n    Args:\n        N (int): Number of rows.\n        M (int): Number of columns. M == N by default.\n        k (int): Index of the diagonal. Zero indicates the main diagonal,\n            a positive index an upper diagonal, and a negative index a lower\n            diagonal.\n        dtype: Data type specifier.\n\n    Returns:\n        cupy.ndarray: A 2-D array with given diagonals filled with ones and\n        zeros elsewhere.\n\n    .. seealso:: :func:`numpy.eye`\n\n    \"\"\"\n    if M is None:\n        M = N\n    ret = zeros((N, M), dtype)\n    ret.diagonal(k)[:] = 1\n    return ret\n\n\ndef identity(n, dtype=float):\n    \"\"\"Returns a 2-D identity array.\n\n    It is equivalent to ``eye(n, n, dtype)``.\n\n    Args:\n        n (int): Number of rows and columns.\n        dtype: Data type specifier.\n\n    Returns:\n        cupy.ndarray: A 2-D identity array.\n\n    .. seealso:: :func:`numpy.identity`\n\n    \"\"\"\n    return eye(n, dtype=dtype)\n\n\ndef ones(shape, dtype=float):\n    \"\"\"Returns a new array of given shape and dtype, filled with ones.\n\n    This function currently does not support ``order`` option.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        dtype: Data type specifier.\n\n    Returns:\n        cupy.ndarray: An array filled with ones.\n\n    .. seealso:: :func:`numpy.ones`\n\n    \"\"\"\n    # TODO(beam2d): Support ordering option\n    a = cupy.ndarray(shape, dtype)\n    a.fill(1)\n    return a\n\n\ndef ones_like(a, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns an array of ones with same shape and dtype as a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        dtype: Data type specifier. The dtype of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n    Returns:\n        cupy.ndarray: An array filled with ones.\n\n    .. seealso:: :func:`numpy.ones_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    a = cupy.ndarray(shape, dtype, memptr, strides, order)\n    a.fill(1)\n    return a\n\n\ndef zeros(shape, dtype=float, order='C'):\n    \"\"\"Returns a new array of given shape and dtype, filled with zeros.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: An array filled with zeros.\n\n    .. seealso:: :func:`numpy.zeros`\n\n    \"\"\"\n    a = cupy.ndarray(shape, dtype, order=order)\n    a.data.memset_async(0, a.nbytes)\n    return a\n\n\ndef zeros_like(a, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns an array of zeros with same shape and dtype as a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        dtype: Data type specifier. The dtype of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n    Returns:\n        cupy.ndarray: An array filled with zeros.\n\n    .. seealso:: :func:`numpy.zeros_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    a = cupy.ndarray(shape, dtype, memptr, strides, order)\n    a.data.memset_async(0, a.nbytes)\n    return a\n\n\ndef full(shape, fill_value, dtype=None):\n    \"\"\"Returns a new array of given shape and dtype, filled with a given value.\n\n    This function currently does not support ``order`` option.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        fill_value: A scalar value to fill a new array.\n        dtype: Data type specifier.\n\n    Returns:\n        cupy.ndarray: An array filled with ``fill_value``.\n\n    .. seealso:: :func:`numpy.full`\n\n    \"\"\"\n    # TODO(beam2d): Support ordering option\n    if dtype is None:\n        if isinstance(fill_value, cupy.ndarray):\n            dtype = fill_value.dtype\n        else:\n            dtype = numpy.array(fill_value).dtype\n    a = cupy.ndarray(shape, dtype)\n    a.fill(fill_value)\n    return a\n\n\ndef full_like(a, fill_value, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns a full array with same shape and dtype as a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        fill_value: A scalar value to fill a new array.\n        dtype: Data type specifier. The dtype of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n    Returns:\n        cupy.ndarray: An array filled with ``fill_value``.\n\n    .. seealso:: :func:`numpy.full_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    a = cupy.ndarray(shape, dtype, memptr, strides, order)\n    a.fill(fill_value)\n    return a\n", "path": "cupy/creation/basic.py"}], "after_files": [{"content": "import cupy\nimport numpy\n\nfrom cupy.core.core import _update_order_char, _get_strides_for_order_K\n\n\ndef empty(shape, dtype=float, order='C'):\n    \"\"\"Returns an array without initializing the elements.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: A new array with elements not initialized.\n\n    .. seealso:: :func:`numpy.empty`\n\n    \"\"\"\n    return cupy.ndarray(shape, dtype, order=order)\n\n\ndef _new_like_order_and_strides(a, dtype, order, shape=None):\n    \"\"\"\n    Determine order and strides as in NumPy's PyArray_NewLikeArray.\n\n    (see: numpy/core/src/multiarray/ctors.c)\n    \"\"\"\n    order = order.upper()\n    if order not in ['C', 'F', 'K', 'A']:\n        raise ValueError('order not understood: {}'.format(order))\n\n    if numpy.isscalar(shape):\n        shape = (shape,)\n\n    # Fallback to c_contiguous if keep order and number of dimensions\n    # of new shape mismatch\n    if order == 'K' and shape is not None and len(shape) != a.ndim:\n        return 'C', None, None\n\n    order = chr(_update_order_char(a, ord(order)))\n\n    if order == 'K':\n        strides = _get_strides_for_order_K(a, numpy.dtype(dtype), shape)\n        order = 'C'\n        memptr = cupy.empty(a.size, dtype=dtype).data\n        return order, strides, memptr\n    else:\n        return order, None, None\n\n\ndef empty_like(a, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns a new array with same shape and dtype of a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        dtype: Data type specifier. The data type of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n\n    Returns:\n        cupy.ndarray: A new array with same shape and dtype of ``a`` with\n        elements not initialized.\n\n    .. seealso:: :func:`numpy.empty_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    return cupy.ndarray(shape, dtype, memptr, strides, order)\n\n\ndef eye(N, M=None, k=0, dtype=float, order='C'):\n    \"\"\"Returns a 2-D array with ones on the diagonals and zeros elsewhere.\n\n    Args:\n        N (int): Number of rows.\n        M (int): Number of columns. M == N by default.\n        k (int): Index of the diagonal. Zero indicates the main diagonal,\n            a positive index an upper diagonal, and a negative index a lower\n            diagonal.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: A 2-D array with given diagonals filled with ones and\n        zeros elsewhere.\n\n    .. seealso:: :func:`numpy.eye`\n\n    \"\"\"\n    if M is None:\n        M = N\n    ret = zeros((N, M), dtype, order=order)\n    ret.diagonal(k)[:] = 1\n    return ret\n\n\ndef identity(n, dtype=float):\n    \"\"\"Returns a 2-D identity array.\n\n    It is equivalent to ``eye(n, n, dtype)``.\n\n    Args:\n        n (int): Number of rows and columns.\n        dtype: Data type specifier.\n\n    Returns:\n        cupy.ndarray: A 2-D identity array.\n\n    .. seealso:: :func:`numpy.identity`\n\n    \"\"\"\n    return eye(n, dtype=dtype)\n\n\ndef ones(shape, dtype=float, order='C'):\n    \"\"\"Returns a new array of given shape and dtype, filled with ones.\n\n    This function currently does not support ``order`` option.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: An array filled with ones.\n\n    .. seealso:: :func:`numpy.ones`\n\n    \"\"\"\n    a = cupy.ndarray(shape, dtype, order=order)\n    a.fill(1)\n    return a\n\n\ndef ones_like(a, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns an array of ones with same shape and dtype as a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        dtype: Data type specifier. The dtype of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n    Returns:\n        cupy.ndarray: An array filled with ones.\n\n    .. seealso:: :func:`numpy.ones_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    a = cupy.ndarray(shape, dtype, memptr, strides, order)\n    a.fill(1)\n    return a\n\n\ndef zeros(shape, dtype=float, order='C'):\n    \"\"\"Returns a new array of given shape and dtype, filled with zeros.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: An array filled with zeros.\n\n    .. seealso:: :func:`numpy.zeros`\n\n    \"\"\"\n    a = cupy.ndarray(shape, dtype, order=order)\n    a.data.memset_async(0, a.nbytes)\n    return a\n\n\ndef zeros_like(a, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns an array of zeros with same shape and dtype as a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        dtype: Data type specifier. The dtype of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n    Returns:\n        cupy.ndarray: An array filled with zeros.\n\n    .. seealso:: :func:`numpy.zeros_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    a = cupy.ndarray(shape, dtype, memptr, strides, order)\n    a.data.memset_async(0, a.nbytes)\n    return a\n\n\ndef full(shape, fill_value, dtype=None, order='C'):\n    \"\"\"Returns a new array of given shape and dtype, filled with a given value.\n\n    This function currently does not support ``order`` option.\n\n    Args:\n        shape (int or tuple of ints): Dimensionalities of the array.\n        fill_value: A scalar value to fill a new array.\n        dtype: Data type specifier.\n        order ({'C', 'F'}): Row-major (C-style) or column-major\n            (Fortran-style) order.\n\n    Returns:\n        cupy.ndarray: An array filled with ``fill_value``.\n\n    .. seealso:: :func:`numpy.full`\n\n    \"\"\"\n    if dtype is None:\n        if isinstance(fill_value, cupy.ndarray):\n            dtype = fill_value.dtype\n        else:\n            dtype = numpy.array(fill_value).dtype\n    a = cupy.ndarray(shape, dtype, order=order)\n    a.fill(fill_value)\n    return a\n\n\ndef full_like(a, fill_value, dtype=None, order='K', subok=None, shape=None):\n    \"\"\"Returns a full array with same shape and dtype as a given array.\n\n    This function currently does not support ``subok`` option.\n\n    Args:\n        a (cupy.ndarray): Base array.\n        fill_value: A scalar value to fill a new array.\n        dtype: Data type specifier. The dtype of ``a`` is used by default.\n        order ({'C', 'F', 'A', or 'K'}): Overrides the memory layout of the\n            result. 'C' means C-order, 'F' means F-order, 'A' means 'F' if\n            ``a`` is Fortran contiguous, 'C' otherwise. 'K' means match the\n            layout of ``a`` as closely as possible.\n        subok: Not supported yet, must be None.\n        shape (int or tuple of ints): Overrides the shape of the result. If\n            order='K' and the number of dimensions is unchanged, will try to\n            keep order, otherwise, order='C' is implied.\n\n    Returns:\n        cupy.ndarray: An array filled with ``fill_value``.\n\n    .. seealso:: :func:`numpy.full_like`\n\n    \"\"\"\n    if subok is not None:\n        raise TypeError('subok is not supported yet')\n    if dtype is None:\n        dtype = a.dtype\n\n    order, strides, memptr = _new_like_order_and_strides(a, dtype, order,\n                                                         shape)\n    shape = shape if shape else a.shape\n    a = cupy.ndarray(shape, dtype, memptr, strides, order)\n    a.fill(fill_value)\n    return a\n", "path": "cupy/creation/basic.py"}]}