get_device

paddle.device. get_device ( ) [source]

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

Examples

import paddle
device = paddle.get_device()