get_device

paddle.device. get_device ( ) [source]

This function can get the current global device of the program is running. It’s a string which is like ‘cpu’, ‘gpu:x’, ‘xpu:x’ and ‘npu:x’. if the global device is not set, it will return a string which is ‘gpu:x’ when cuda is available or it will return a string which is ‘cpu’ when cuda is not available.

Examples

>>> import paddle
>>> device = paddle.device.get_device()