chainer.backends.cuda.get_device_from_array

chainer.backends.cuda.get_device_from_array(*arrays)[source]

Gets the device from a list of CuPy array or a single CuPy array.

The device on which the given CuPy array reside is returned.

Note

This method only recognizes cupy.ndarrays in arguments. Especially note that, unlike get_array_module(), this method does not recognize Variable objects. If you need to get device from the Variable instance v, you need to use get_device_from_array(v.array).

Parameters:arrays (cupy.ndarray or list of cupy.ndarray) – A CuPy array which this function returns the device corresponding to. If a list of cupy.ndarrays are given, it returns the first device object of an array in the list.