def copy(array, out=None, out_device=None, stream=None):
    check_cuda_available()
    assert stream is None  # TODO(beam2d): FIX IT

    if out is None:
        if out_device is None:
            out_device = array
        with get_device(out_device):
            out = cupy.empty_like(array)

    with get_device(array):
        cupy.copyto(out, array)

    return out


# ------------------------------------------------------------------------------
# Function result memoization
# ------------------------------------------------------------------------------
Copies a :class:`cupy.ndarray` object using the default stream.
dataset/ETHPy150Open pfnet/chainer/chainer/cuda.py/copy