chainer.using_device¶
- chainer.using_device(device_spec)[source]¶
Context manager to apply the thread-local device state.
- Parameters
device_spec (object) – Device specifier. See
chainer.get_device()
for details.
Example
with chainer.using_device('@cupy:1'): a = cupy.empty((3, 2)) assert a.device.id == 1