chainer.dataset.to_device

chainer.dataset.to_device(device, x)[source]

Send an array to a given device.

This method sends a given array to a given device. This method is used in concat_examples(). You can also use this method in a custom converter method used in Updater and Extension such as StandardUpdater and Evaluator.

See also chainer.dataset.concat_examples().

Parameters:
  • device (int or None) – Device ID to which an array is sent. If it is negative value, an array is sent to CPU. If it is positive, an array is sent to GPU with the given ID. If it is None, an array is left in the original device.
  • x (numpy.ndarray or cupy.ndarray) – An array to send.
Returns:

Converted array.