This class extends cupy.Device, with id > 0 representing the id_th GPU, and id = -1 representing CPU. cupy must be installed to use GPUs.
The array module for the corresponding device can be obtained via .xp. Similar to cupy.Device, the Device object can be used as a context:
>>> device = Device(2) >>> xp = device.xp # xp is cupy. >>> with device: >>> x = xp.array([1, 2, 3]) >>> x += 1
Parameters: id_or_device (int or Device or cupy.cuda.Device) – id > 0 represents the corresponding GPUs, and id = -1 represents CPU.
id = -1 represents CPU, and others represents the id_th GPUs.
Initialize self. See help(type(self)) for accurate signature.
Use computing device.
numpy or cupy module for the device.