We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
chainer.functions.Parameter cannot accept cupy.ndarray
```
In [1]: import numpy, chainer, cupy
In [2]: p = chainer.functions.Parameter(numpy.arange(12, dtype=numpy.float32))
In [3]: p = chainer.functions.Parameter(cupy.arange(12, dtype=numpy.float32))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-3bee41ef9fca> in <module>()
----> 1 p = chainer.functions.Parameter(cupy.arange(12, dtype=numpy.float32))

/home/delta/dev/chainer2/chainer/functions/connection/parameter.py in __init__(self, array)
     21     def __init__(self, array):
     22         self.W = array
---> 23         self.gW = numpy.full_like(array, numpy.nan)
     24 
     25     def __call__(self, volatile=False):

/home/delta/.pyenv/versions/pyenv-2.7.9/lib/python2.7/site-packages/numpy/core/numeric.pyc in full_like(a, fill_value, dtype, order, subok)
    344 
    345     """
--> 346     res = empty_like(a, dtype=dtype, order=order, subok=subok)
    347     multiarray.copyto(res, fill_value, casting='unsafe')
    348     return res

ValueError: object __array__ method not producing an array
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `chainer/functions/connection/parameter.py`
Content:
```
1 import numpy
2 
3 from chainer import function
4 from chainer.utils import type_check
5 
6 
7 class Parameter(function.Function):
8 
9     """Function that outputs its weight array.
10 
11     This is a parameterized function that takes no input and returns a variable
12     holding a shallow copy of the parameter array.
13 
14     Args:
15         array: Initial parameter array.
16 
17     """
18     parameter_names = 'W',
19     gradient_names = 'gW',
20 
21     def __init__(self, array):
22         self.W = array
23         self.gW = numpy.full_like(array, numpy.nan)
24 
25     def __call__(self, volatile=False):
26         ret = super(Parameter, self).__call__()
27         if volatile:
28             ret.unchain_backward()
29         ret.volatile = volatile
30         return ret
31 
32     def check_type_forward(self, in_types):
33         type_check.expect(in_types.size() == 0)
34 
35     def forward(self, x):
36         return self.W,
37 
38     def backward(self, x, gy):
39         self.gW += gy[0]
40         return ()
41
```
--- 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/chainer/functions/connection/parameter.py b/chainer/functions/connection/parameter.py
--- a/chainer/functions/connection/parameter.py
+++ b/chainer/functions/connection/parameter.py
@@ -1,5 +1,6 @@
 import numpy
 
+from chainer import cuda
 from chainer import function
 from chainer.utils import type_check
 
@@ -20,7 +21,8 @@
 
     def __init__(self, array):
         self.W = array
-        self.gW = numpy.full_like(array, numpy.nan)
+        xp = cuda.get_array_module(array)
+        self.gW = xp.full_like(self.W, numpy.nan)
 
     def __call__(self, volatile=False):
         ret = super(Parameter, self).__call__()

{"golden_diff": "diff --git a/chainer/functions/connection/parameter.py b/chainer/functions/connection/parameter.py\n--- a/chainer/functions/connection/parameter.py\n+++ b/chainer/functions/connection/parameter.py\n@@ -1,5 +1,6 @@\n import numpy\n \n+from chainer import cuda\n from chainer import function\n from chainer.utils import type_check\n \n@@ -20,7 +21,8 @@\n \n     def __init__(self, array):\n         self.W = array\n-        self.gW = numpy.full_like(array, numpy.nan)\n+        xp = cuda.get_array_module(array)\n+        self.gW = xp.full_like(self.W, numpy.nan)\n \n     def __call__(self, volatile=False):\n         ret = super(Parameter, self).__call__()\n", "issue": "chainer.functions.Parameter cannot accept cupy.ndarray\n```\nIn [1]: import numpy, chainer, cupy\nIn [2]: p = chainer.functions.Parameter(numpy.arange(12, dtype=numpy.float32))\nIn [3]: p = chainer.functions.Parameter(cupy.arange(12, dtype=numpy.float32))\n---------------------------------------------------------------------------\nValueError                                Traceback (most recent call last)\n<ipython-input-3-3bee41ef9fca> in <module>()\n----> 1 p = chainer.functions.Parameter(cupy.arange(12, dtype=numpy.float32))\n\n/home/delta/dev/chainer2/chainer/functions/connection/parameter.py in __init__(self, array)\n     21     def __init__(self, array):\n     22         self.W = array\n---> 23         self.gW = numpy.full_like(array, numpy.nan)\n     24 \n     25     def __call__(self, volatile=False):\n\n/home/delta/.pyenv/versions/pyenv-2.7.9/lib/python2.7/site-packages/numpy/core/numeric.pyc in full_like(a, fill_value, dtype, order, subok)\n    344 \n    345     \"\"\"\n--> 346     res = empty_like(a, dtype=dtype, order=order, subok=subok)\n    347     multiarray.copyto(res, fill_value, casting='unsafe')\n    348     return res\n\nValueError: object __array__ method not producing an array\n```\n\n", "before_files": [{"content": "import numpy\n\nfrom chainer import function\nfrom chainer.utils import type_check\n\n\nclass Parameter(function.Function):\n\n    \"\"\"Function that outputs its weight array.\n\n    This is a parameterized function that takes no input and returns a variable\n    holding a shallow copy of the parameter array.\n\n    Args:\n        array: Initial parameter array.\n\n    \"\"\"\n    parameter_names = 'W',\n    gradient_names = 'gW',\n\n    def __init__(self, array):\n        self.W = array\n        self.gW = numpy.full_like(array, numpy.nan)\n\n    def __call__(self, volatile=False):\n        ret = super(Parameter, self).__call__()\n        if volatile:\n            ret.unchain_backward()\n        ret.volatile = volatile\n        return ret\n\n    def check_type_forward(self, in_types):\n        type_check.expect(in_types.size() == 0)\n\n    def forward(self, x):\n        return self.W,\n\n    def backward(self, x, gy):\n        self.gW += gy[0]\n        return ()\n", "path": "chainer/functions/connection/parameter.py"}], "after_files": [{"content": "import numpy\n\nfrom chainer import cuda\nfrom chainer import function\nfrom chainer.utils import type_check\n\n\nclass Parameter(function.Function):\n\n    \"\"\"Function that outputs its weight array.\n\n    This is a parameterized function that takes no input and returns a variable\n    holding a shallow copy of the parameter array.\n\n    Args:\n        array: Initial parameter array.\n\n    \"\"\"\n    parameter_names = 'W',\n    gradient_names = 'gW',\n\n    def __init__(self, array):\n        self.W = array\n        xp = cuda.get_array_module(array)\n        self.gW = xp.full_like(self.W, numpy.nan)\n\n    def __call__(self, volatile=False):\n        ret = super(Parameter, self).__call__()\n        if volatile:\n            ret.unchain_backward()\n        ret.volatile = volatile\n        return ret\n\n    def check_type_forward(self, in_types):\n        type_check.expect(in_types.size() == 0)\n\n    def forward(self, x):\n        return self.W,\n\n    def backward(self, x, gy):\n        self.gW += gy[0]\n        return ()\n", "path": "chainer/functions/connection/parameter.py"}]}