Skip to content

Commit 0b7f43e

Browse files
authored
fix device docs;test=document_fix (#36784) (#36827)
* fix device docs;test=document_fix * update __init__.py
1 parent 05b8630 commit 0b7f43e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

python/paddle/device/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def is_compiled_with_npu():
4848
.. code-block:: python
4949
5050
import paddle
51-
support_npu = paddle.is_compiled_with_npu()
51+
support_npu = paddle.device.is_compiled_with_npu()
5252
"""
5353
return core.is_compiled_with_npu()
5454

@@ -63,7 +63,7 @@ def is_compiled_with_xpu():
6363
.. code-block:: python
6464
6565
import paddle
66-
support_xpu = paddle.is_compiled_with_xpu()
66+
support_xpu = paddle.device.is_compiled_with_xpu()
6767
"""
6868
return core.is_compiled_with_xpu()
6969

@@ -77,10 +77,11 @@ def XPUPlace(dev_id):
7777
7878
Examples:
7979
.. code-block:: python
80+
8081
# required: xpu
8182
8283
import paddle
83-
place = paddle.XPUPlace(0)
84+
place = paddle.device.XPUPlace(0)
8485
"""
8586
return core.XPUPlace(dev_id)
8687

@@ -98,7 +99,7 @@ def get_cudnn_version():
9899
99100
import paddle
100101
101-
cudnn_version = paddle.get_cudnn_version()
102+
cudnn_version = paddle.device.get_cudnn_version()
102103
103104
104105
@@ -195,7 +196,7 @@ def set_device(device):
195196
196197
import paddle
197198
198-
paddle.set_device("cpu")
199+
paddle.device.set_device("cpu")
199200
x1 = paddle.ones(name='x1', shape=[1, 2], dtype='int32')
200201
x2 = paddle.zeros(name='x2', shape=[1, 2], dtype='int32')
201202
data = paddle.stack([x1,x2], axis=1)
@@ -217,7 +218,7 @@ def get_device():
217218
.. code-block:: python
218219
219220
import paddle
220-
device = paddle.get_device()
221+
device = paddle.device.get_device()
221222
222223
"""
223224
device = ''

python/paddle/fluid/framework.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def is_compiled_with_cuda():
430430
.. code-block:: python
431431
432432
import paddle
433-
support_gpu = paddle.is_compiled_with_cuda()
433+
support_gpu = paddle.device.is_compiled_with_cuda()
434434
"""
435435
return core.is_compiled_with_cuda()
436436

@@ -445,7 +445,7 @@ def is_compiled_with_rocm():
445445
.. code-block:: python
446446
447447
import paddle
448-
support_gpu = paddle.is_compiled_with_rocm()
448+
support_gpu = paddle.device.is_compiled_with_rocm()
449449
"""
450450
return core.is_compiled_with_rocm()
451451

0 commit comments

Comments
 (0)