chainer.backends.cuda.to_cpu

chainer.backends.cuda.to_cpu(array, stream=None)[source]

Copies the given GPU array to host CPU.

Parameters
  • array (array, None, list or tuple) – Array or arrays to be sent to CPU.

  • stream (cupy.cuda.Stream) – CUDA stream.

Returns

Array on CPU.

If some of the arrays are already on CPU, then this function just returns those arrays without performing any copy.

If input arrays include None, it is returned as None as is.

Return type

numpy.ndarray, list or tuple