chainerx.get_device

chainerx.get_device(*device)

Returns a device specified by the arguments.

If the argument is a single Device instance, it’s simply returned.

Otherwise, there are three ways to specify a device:

# Specify a backend name and a device index separately.
chainerx.get_device('native', 0)

# Specify a backend name and a device index in a single string.
chainerx.get_device('native:0')

# Specify only a backend name. In this case device index 0 is chosen.
chainerx.get_device('native')
Returns

Device object.

Return type

Device