Skip to content

Commit 16f76f5

Browse files
committed
Fix device bugs (PaddlePaddle#3647)
* update_device_api bugs * fix device apis * fix xpu docs * fix xpu docs
1 parent acea0a4 commit 16f76f5

8 files changed

+17
-29
lines changed

docs/api/paddle/device/XPUPlace_cn.rst

+2-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
XPUPlace
44
-------------------------------
55

6-
.. py:class:: paddle.XPUPlace
6+
.. py:class:: paddle.device.XPUPlace
77
88
99
@@ -18,12 +18,4 @@ XPUPlace
1818

1919
**代码示例**
2020

21-
.. code-block:: python
22-
23-
import paddle
24-
25-
place = paddle.XPUPlace(0)
26-
27-
28-
29-
21+
COPY-FROM: paddle.device.XPUPlace

docs/api/paddle/device/get_cudnn_version_cn.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
get_cudnn_version
44
-------------------------------
55

6-
.. py:function:: paddle.get_cudnn_version()
6+
.. py:function:: paddle.device.get_cudnn_version()
77
88
99
此函数返回cudnn的版本。 返回值是int,它表示cudnn版本。 例如,如果返回7600,则表示cudnn的版本为7.6。
@@ -16,4 +16,4 @@ get_cudnn_version
1616
1717
import paddle
1818
19-
device = paddle.get_cudnn_version()
19+
device = paddle.device.get_cudnn_version()

docs/api/paddle/device/get_device_cn.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
get_device
44
-------------------------------
55

6-
.. py:function:: paddle.get_device()
6+
.. py:function:: paddle.device.get_device()
77
88
99
该功能返回当前程序运行的全局设备,返回的是一个类似于 ``cpu`` 或者 ``gpu:0`` 字符串,如果没有设置全局设备,当cuda可用的时候返回 ``gpu:0`` ,当cuda不可用的时候返回 ``cpu`` 。
@@ -16,4 +16,4 @@ get_device
1616
1717
import paddle
1818
19-
device = paddle.get_device()
19+
device = paddle.device.get_device()

docs/api/paddle/device/is_compiled_with_cuda_cn.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
is_compiled_with_cuda
44
-------------------------------
55

6-
.. py:function:: paddle.is_compiled_with_cuda()
6+
.. py:function:: paddle.device.is_compiled_with_cuda()
77
88
99
@@ -19,6 +19,6 @@ is_compiled_with_cuda
1919
.. code-block:: python
2020
2121
import paddle
22-
support_gpu = paddle.is_compiled_with_cuda()
22+
support_gpu = paddle.device.is_compiled_with_cuda()
2323
2424

docs/api/paddle/device/is_compiled_with_npu_cn.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
is_compiled_with_npu
44
-------------------------------
55

6-
.. py:function:: paddle.fluid.is_compiled_with_npu()
6+
.. py:function:: paddle.device.is_compiled_with_npu()
7+
78
检查 ``whl`` 包是否可以被用来在 NPU 上运行模型。
89

910
返回:支持 NPU 则为True,否则为False。
@@ -12,5 +13,5 @@ is_compiled_with_npu
1213

1314
**示例代码**
1415

15-
COPY-FROM: paddle.is_compiled_with_npu
16+
COPY-FROM: paddle.device.is_compiled_with_npu
1617

docs/api/paddle/device/is_compiled_with_rocm_cn.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
is_compiled_with_rocm
44
-------------------------------
55

6-
.. py:function:: paddle.is_compiled_with_rocm()
6+
.. py:function:: paddle.device.is_compiled_with_rocm()
77
88
99
@@ -17,6 +17,6 @@ is_compiled_with_rocm
1717
.. code-block:: python
1818
1919
import paddle
20-
support_gpu = paddle.is_compiled_with_rocm()
20+
support_rocm = paddle.device.is_compiled_with_rocm()
2121
2222

docs/api/paddle/device/is_compiled_with_xpu_cn.rst

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
is_compiled_with_xpu
44
-------------------------------
55

6-
.. py:function:: paddle.is_compiled_with_xpu()
6+
.. py:function:: paddle.device.is_compiled_with_xpu()
77
88
99
@@ -14,9 +14,4 @@ is_compiled_with_xpu
1414

1515
**示例代码**
1616

17-
.. code-block:: python
18-
19-
import paddle
20-
support_xpu = paddle.is_compiled_with_xpu()
21-
22-
17+
COPY-FROM: paddle.device.is_compiled_with_xpu

docs/api/paddle/set_device_cn.rst renamed to docs/api/paddle/device/set_device_cn.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set_device
44
-------------------------------
55

6-
.. py:function:: paddle.set_device(device)
6+
.. py:function:: paddle.device.set_device(device)
77
88
99
Paddle支持包括CPU和GPU在内的多种设备运行,设备可以通过字符串标识符表示,此功能可以指定OP运行的全局设备。
@@ -19,7 +19,7 @@ Paddle支持包括CPU和GPU在内的多种设备运行,设备可以通过字
1919
2020
import paddle
2121
22-
paddle.set_device("cpu")
22+
paddle.device.set_device("cpu")
2323
x1 = paddle.ones(name='x1', shape=[1, 2], dtype='int32')
2424
x2 = paddle.zeros(name='x2', shape=[1, 2], dtype='int32')
2525
data = paddle.stack([x1,x2], axis=1)

0 commit comments

Comments
 (0)