Skip to content

Commit

Permalink
fix device docs;test=document_fix (PaddlePaddle#36784)
Browse files Browse the repository at this point in the history
* fix device docs;test=document_fix

* update __init__.py
  • Loading branch information
Ligoml authored and piotrekobi committed Nov 3, 2021
1 parent 8df0f99 commit 201c923
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions python/paddle/device/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def is_compiled_with_npu():
.. code-block:: python
import paddle
support_npu = paddle.is_compiled_with_npu()
support_npu = paddle.device.is_compiled_with_npu()
"""
return core.is_compiled_with_npu()

Expand All @@ -63,7 +63,7 @@ def is_compiled_with_xpu():
.. code-block:: python
import paddle
support_xpu = paddle.is_compiled_with_xpu()
support_xpu = paddle.device.is_compiled_with_xpu()
"""
return core.is_compiled_with_xpu()

Expand All @@ -77,10 +77,11 @@ def XPUPlace(dev_id):
Examples:
.. code-block:: python
# required: xpu
import paddle
place = paddle.XPUPlace(0)
place = paddle.device.XPUPlace(0)
"""
return core.XPUPlace(dev_id)

Expand All @@ -98,7 +99,7 @@ def get_cudnn_version():
import paddle
cudnn_version = paddle.get_cudnn_version()
cudnn_version = paddle.device.get_cudnn_version()
Expand Down Expand Up @@ -195,7 +196,7 @@ def set_device(device):
import paddle
paddle.set_device("cpu")
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)
Expand All @@ -217,7 +218,7 @@ def get_device():
.. code-block:: python
import paddle
device = paddle.get_device()
device = paddle.device.get_device()
"""
device = ''
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/fluid/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def is_compiled_with_cuda():
.. code-block:: python
import paddle
support_gpu = paddle.is_compiled_with_cuda()
support_gpu = paddle.device.is_compiled_with_cuda()
"""
return core.is_compiled_with_cuda()

Expand All @@ -482,7 +482,7 @@ def is_compiled_with_rocm():
.. code-block:: python
import paddle
support_gpu = paddle.is_compiled_with_rocm()
support_gpu = paddle.device.is_compiled_with_rocm()
"""
return core.is_compiled_with_rocm()

Expand Down

0 comments on commit 201c923

Please sign in to comment.