#NEWLINE# def copy( array , out = None , out_device = None , stream = None ) : #NEWLINE# #INDENT# 'Copies a :class:`cupy.ndarray` object using the default stream.\n\n    This function can copy the device array to the destination array on another\n    device.\n\n    Args:\n        array (cupy.ndarray): Array to be copied.\n        out (cupy.ndarray): Destination array.\n            If it is not ``None``, then ``out_device`` argument is ignored.\n        out_device: Destination device specifier. Actual device object is\n            obtained by passing this value to :func:`get_device`.\n        stream (cupy.cuda.Stream): CUDA stream.\n\n    Returns:\n        cupy.ndarray: Copied array.\n\n        If ``out`` is not specified, then the array is allocated on the device\n        specified by ``out_device`` argument.\n\n    ' #NEWLINE# check_cuda_available ( ) #NEWLINE# assert ( stream is None ) #NEWLINE# if ( out is None ) : #NEWLINE# #INDENT# if ( out_device is None ) : #NEWLINE# #INDENT# out_device = array #NEWLINE# #UNINDENT# with get_device ( out_device ) : #NEWLINE# #INDENT# out = cupy . empty_like ( array ) #NEWLINE# #UNINDENT# #UNINDENT# with get_device ( array ) : #NEWLINE# #INDENT# cupy . copyto ( out , array ) #NEWLINE# #UNINDENT# return out