set_device¶
- paddle.device. set_device ( device ) [source]
- 
         Paddle supports running calculations on various types of devices, including CPU, GPU, XPU, NPU, MLU and IPU. They are represented by string identifiers. This function can specify the global device which the OP will run. - Parameters
- 
           device (str) – This parameter determines the specific running device. It can be cpu,gpu,xpu,npu,mlu,gpu:x,xpu:x,npu:x,mlu:xandipu, wherexis the index of the GPUs, XPUs, NPUs or MLUs.
 Examples import paddle paddle.device.set_device("cpu") x1 = paddle.ones(name='x1', shape=[1, 2], dtype='int32') x2 = paddle.zeros(name='x2', shape=[1, 2], dtype='int32') data = paddle.stack([x1,x2], axis=1) 
