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 (None or int or device specifier) – A device to which an array is sent. If it is a negative integer, an array is sent to CPU. If it is a positive integer, an array is sent to GPU with the given ID. If it is``None``, an array is left in the original device. Also, any of device specifiers described at DeviceId is accepted.

  • x (N-dimensional array) – An array to send.

Returns

Converted array.