未验证 提交 d4b0d03b 编写于 作者: L Ligoml 提交者: GitHub

fix device docs;test=document_fix (#36784)

* fix device docs;test=document_fix

* update __init__.py
上级 6edbdbfa
...@@ -48,7 +48,7 @@ def is_compiled_with_npu(): ...@@ -48,7 +48,7 @@ def is_compiled_with_npu():
.. code-block:: python .. code-block:: python
import paddle import paddle
support_npu = paddle.is_compiled_with_npu() support_npu = paddle.device.is_compiled_with_npu()
""" """
return core.is_compiled_with_npu() return core.is_compiled_with_npu()
...@@ -63,7 +63,7 @@ def is_compiled_with_xpu(): ...@@ -63,7 +63,7 @@ def is_compiled_with_xpu():
.. code-block:: python .. code-block:: python
import paddle import paddle
support_xpu = paddle.is_compiled_with_xpu() support_xpu = paddle.device.is_compiled_with_xpu()
""" """
return core.is_compiled_with_xpu() return core.is_compiled_with_xpu()
...@@ -77,10 +77,11 @@ def XPUPlace(dev_id): ...@@ -77,10 +77,11 @@ def XPUPlace(dev_id):
Examples: Examples:
.. code-block:: python .. code-block:: python
# required: xpu # required: xpu
import paddle import paddle
place = paddle.XPUPlace(0) place = paddle.device.XPUPlace(0)
""" """
return core.XPUPlace(dev_id) return core.XPUPlace(dev_id)
...@@ -98,7 +99,7 @@ def get_cudnn_version(): ...@@ -98,7 +99,7 @@ def get_cudnn_version():
import paddle import paddle
cudnn_version = paddle.get_cudnn_version() cudnn_version = paddle.device.get_cudnn_version()
...@@ -195,7 +196,7 @@ def set_device(device): ...@@ -195,7 +196,7 @@ def set_device(device):
import paddle import paddle
paddle.set_device("cpu") paddle.device.set_device("cpu")
x1 = paddle.ones(name='x1', shape=[1, 2], dtype='int32') x1 = paddle.ones(name='x1', shape=[1, 2], dtype='int32')
x2 = paddle.zeros(name='x2', shape=[1, 2], dtype='int32') x2 = paddle.zeros(name='x2', shape=[1, 2], dtype='int32')
data = paddle.stack([x1,x2], axis=1) data = paddle.stack([x1,x2], axis=1)
...@@ -217,7 +218,7 @@ def get_device(): ...@@ -217,7 +218,7 @@ def get_device():
.. code-block:: python .. code-block:: python
import paddle import paddle
device = paddle.get_device() device = paddle.device.get_device()
""" """
device = '' device = ''
......
...@@ -467,7 +467,7 @@ def is_compiled_with_cuda(): ...@@ -467,7 +467,7 @@ def is_compiled_with_cuda():
.. code-block:: python .. code-block:: python
import paddle import paddle
support_gpu = paddle.is_compiled_with_cuda() support_gpu = paddle.device.is_compiled_with_cuda()
""" """
return core.is_compiled_with_cuda() return core.is_compiled_with_cuda()
...@@ -482,7 +482,7 @@ def is_compiled_with_rocm(): ...@@ -482,7 +482,7 @@ def is_compiled_with_rocm():
.. code-block:: python .. code-block:: python
import paddle import paddle
support_gpu = paddle.is_compiled_with_rocm() support_gpu = paddle.device.is_compiled_with_rocm()
""" """
return core.is_compiled_with_rocm() return core.is_compiled_with_rocm()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册