chainer.cuda.to_gpu

chainer.cuda.to_gpu(array, device=None, stream=None)[source]

Copies the given CPU array to the specified device.

Parameters:
  • array – Array to be sent to GPU.
  • device – Device specifier.
  • stream (Stream) – (deprecated since v3.0.0) CUDA stream. If not None, the copy runs asynchronously.
Returns:

Array on GPU.

If array is already on the GPU device specified by device, this function just returns array without performing any copy.

Return type:

cupy.ndarray