- 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’, ‘xpu:x’, ‘mlu:x’ and ‘npu: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.
import paddle device = paddle.device.get_device()