cupy.asnumpy(a, stream=None, order='C', out=None, *, blocking=True)[source]#

Returns an array on the host memory from an arbitrary source array.

  • a – Arbitrary object that can be converted to numpy.ndarray.

  • stream (cupy.cuda.Stream) – CUDA stream object. If given, the stream is used to perform the copy. Otherwise, the current stream is used. Note that if a is not a cupy.ndarray object, then this argument has no effect.

  • order ({'C', 'F', 'A'}) – The desired memory layout of the host array. When order is ‘A’, it uses ‘F’ if the array is fortran-contiguous and ‘C’ otherwise. The order will be ignored if out is specified.

  • out (numpy.ndarray) – The output array to be written to. It must have compatible shape and dtype with those of a’s.

  • blocking (bool) – If set to False, the copy runs asynchronously on the given (if given) or current stream, and users are responsible for ensuring the stream order. Default is True, so the copy is synchronous (with respect to the host).


Converted array on the host memory.

Return type: