From 7180c1318f9d3bd4efd387c2a6a761e8082d75de Mon Sep 17 00:00:00 2001 From: TCChenLong <1300851984@qq.com> Date: Mon, 5 Jul 2021 23:52:19 +0800 Subject: [PATCH 1/4] update_device_api bugs --- docs/api/paddle/device/is_compiled_with_npu_cn.rst | 2 +- docs/api/paddle/device/is_compiled_with_rocm_cn.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/paddle/device/is_compiled_with_npu_cn.rst b/docs/api/paddle/device/is_compiled_with_npu_cn.rst index 397a94e2950..4eb9910ed08 100644 --- a/docs/api/paddle/device/is_compiled_with_npu_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_npu_cn.rst @@ -12,5 +12,5 @@ is_compiled_with_npu **示例代码** -COPY-FROM: paddle.is_compiled_with_npu +COPY-FROM: paddle.device.is_compiled_with_npu diff --git a/docs/api/paddle/device/is_compiled_with_rocm_cn.rst b/docs/api/paddle/device/is_compiled_with_rocm_cn.rst index 35c26ba80cf..73d6c98dd77 100644 --- a/docs/api/paddle/device/is_compiled_with_rocm_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_rocm_cn.rst @@ -17,6 +17,6 @@ is_compiled_with_rocm .. code-block:: python import paddle - support_gpu = paddle.is_compiled_with_rocm() + support_rocm = paddle.is_compiled_with_rocm() From 15b47ce052e945bed20a69358cc38b350f6a19fe Mon Sep 17 00:00:00 2001 From: TCChenLong <1300851984@qq.com> Date: Mon, 5 Jul 2021 23:56:10 +0800 Subject: [PATCH 2/4] fix device apis --- docs/api/paddle/device/XPUPlace_cn.rst | 4 ++-- docs/api/paddle/device/get_cudnn_version_cn.rst | 4 ++-- docs/api/paddle/device/get_device_cn.rst | 4 ++-- docs/api/paddle/device/is_compiled_with_cuda_cn.rst | 4 ++-- docs/api/paddle/device/is_compiled_with_npu_cn.rst | 3 ++- docs/api/paddle/device/is_compiled_with_rocm_cn.rst | 4 ++-- docs/api/paddle/device/is_compiled_with_xpu_cn.rst | 4 ++-- docs/api/paddle/{ => device}/set_device_cn.rst | 4 ++-- 8 files changed, 16 insertions(+), 15 deletions(-) rename docs/api/paddle/{ => device}/set_device_cn.rst (91%) diff --git a/docs/api/paddle/device/XPUPlace_cn.rst b/docs/api/paddle/device/XPUPlace_cn.rst index b7fa4b75b7a..3c848f02c10 100644 --- a/docs/api/paddle/device/XPUPlace_cn.rst +++ b/docs/api/paddle/device/XPUPlace_cn.rst @@ -3,7 +3,7 @@ XPUPlace ------------------------------- -.. py:class:: paddle.XPUPlace +.. py:class:: paddle.device.XPUPlace @@ -22,7 +22,7 @@ XPUPlace import paddle - place = paddle.XPUPlace(0) + place = paddle.device.XPUPlace(0) diff --git a/docs/api/paddle/device/get_cudnn_version_cn.rst b/docs/api/paddle/device/get_cudnn_version_cn.rst index 03ef24cdf29..42d8f7e4f12 100644 --- a/docs/api/paddle/device/get_cudnn_version_cn.rst +++ b/docs/api/paddle/device/get_cudnn_version_cn.rst @@ -3,7 +3,7 @@ get_cudnn_version ------------------------------- -.. py:function:: paddle.get_cudnn_version() +.. py:function:: paddle.device.get_cudnn_version() 此函数返回cudnn的版本。 返回值是int,它表示cudnn版本。 例如,如果返回7600,则表示cudnn的版本为7.6。 @@ -16,4 +16,4 @@ get_cudnn_version import paddle - device = paddle.get_cudnn_version() + device = paddle.device.get_cudnn_version() diff --git a/docs/api/paddle/device/get_device_cn.rst b/docs/api/paddle/device/get_device_cn.rst index bf351ac2afc..08b549ab35e 100644 --- a/docs/api/paddle/device/get_device_cn.rst +++ b/docs/api/paddle/device/get_device_cn.rst @@ -3,7 +3,7 @@ get_device ------------------------------- -.. py:function:: paddle.get_device() +.. py:function:: paddle.device.get_device() 该功能返回当前程序运行的全局设备,返回的是一个类似于 ``cpu``、 ``gpu:x``、 ``xpu:x`` 或者 ``npu:x`` 字符串,如果没有设置全局设备,当cuda可用的时候返回 ``gpu:0`` ,当cuda不可用的时候返回 ``cpu`` 。 @@ -16,4 +16,4 @@ get_device import paddle - device = paddle.get_device() + device = paddle.device.get_device() diff --git a/docs/api/paddle/device/is_compiled_with_cuda_cn.rst b/docs/api/paddle/device/is_compiled_with_cuda_cn.rst index 3bbe4f90f1a..da8cd116e6d 100644 --- a/docs/api/paddle/device/is_compiled_with_cuda_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_cuda_cn.rst @@ -3,7 +3,7 @@ is_compiled_with_cuda ------------------------------- -.. py:function:: paddle.is_compiled_with_cuda() +.. py:function:: paddle.device.is_compiled_with_cuda() @@ -19,6 +19,6 @@ is_compiled_with_cuda .. code-block:: python import paddle - support_gpu = paddle.is_compiled_with_cuda() + support_gpu = paddle.device.is_compiled_with_cuda() diff --git a/docs/api/paddle/device/is_compiled_with_npu_cn.rst b/docs/api/paddle/device/is_compiled_with_npu_cn.rst index 4eb9910ed08..b52a9904d27 100644 --- a/docs/api/paddle/device/is_compiled_with_npu_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_npu_cn.rst @@ -3,7 +3,8 @@ is_compiled_with_npu ------------------------------- -.. py:function:: paddle.fluid.is_compiled_with_npu() +.. py:function:: paddle.device.is_compiled_with_npu() + 检查 ``whl`` 包是否可以被用来在 NPU 上运行模型。 返回:支持 NPU 则为True,否则为False。 diff --git a/docs/api/paddle/device/is_compiled_with_rocm_cn.rst b/docs/api/paddle/device/is_compiled_with_rocm_cn.rst index 73d6c98dd77..2bcabf49fb5 100644 --- a/docs/api/paddle/device/is_compiled_with_rocm_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_rocm_cn.rst @@ -3,7 +3,7 @@ is_compiled_with_rocm ------------------------------- -.. py:function:: paddle.is_compiled_with_rocm() +.. py:function:: paddle.device.is_compiled_with_rocm() @@ -17,6 +17,6 @@ is_compiled_with_rocm .. code-block:: python import paddle - support_rocm = paddle.is_compiled_with_rocm() + support_rocm = paddle.device.is_compiled_with_rocm() diff --git a/docs/api/paddle/device/is_compiled_with_xpu_cn.rst b/docs/api/paddle/device/is_compiled_with_xpu_cn.rst index b1e87083c88..c83bb89f2d7 100644 --- a/docs/api/paddle/device/is_compiled_with_xpu_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_xpu_cn.rst @@ -3,7 +3,7 @@ is_compiled_with_xpu ------------------------------- -.. py:function:: paddle.is_compiled_with_xpu() +.. py:function:: paddle.device.is_compiled_with_xpu() @@ -17,6 +17,6 @@ is_compiled_with_xpu .. code-block:: python import paddle - support_xpu = paddle.is_compiled_with_xpu() + support_xpu = paddle.device.is_compiled_with_xpu() diff --git a/docs/api/paddle/set_device_cn.rst b/docs/api/paddle/device/set_device_cn.rst similarity index 91% rename from docs/api/paddle/set_device_cn.rst rename to docs/api/paddle/device/set_device_cn.rst index 45f16af525f..1602b49a73f 100644 --- a/docs/api/paddle/set_device_cn.rst +++ b/docs/api/paddle/device/set_device_cn.rst @@ -3,7 +3,7 @@ set_device ------------------------------- -.. py:function:: paddle.set_device(device) +.. py:function:: paddle.device.set_device(device) Paddle支持包括CPU和GPU在内的多种设备运行,设备可以通过字符串标识符表示,此功能可以指定OP运行的全局设备。 @@ -19,7 +19,7 @@ Paddle支持包括CPU和GPU在内的多种设备运行,设备可以通过字 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) From 7f60dfe6ee0a3aecf2e078257a7585646c007c30 Mon Sep 17 00:00:00 2001 From: TCChenLong <1300851984@qq.com> Date: Tue, 6 Jul 2021 11:47:15 +0800 Subject: [PATCH 3/4] fix xpu docs --- docs/api/paddle/device/is_compiled_with_xpu_cn.rst | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/api/paddle/device/is_compiled_with_xpu_cn.rst b/docs/api/paddle/device/is_compiled_with_xpu_cn.rst index c83bb89f2d7..14105bb4fa4 100644 --- a/docs/api/paddle/device/is_compiled_with_xpu_cn.rst +++ b/docs/api/paddle/device/is_compiled_with_xpu_cn.rst @@ -14,9 +14,4 @@ is_compiled_with_xpu **示例代码** -.. code-block:: python - - import paddle - support_xpu = paddle.device.is_compiled_with_xpu() - - +COPY-FROM: paddle.device.is_compiled_with_xpu From 074cdea68ce6c687313afb45e255eb0ef41ac4d1 Mon Sep 17 00:00:00 2001 From: TCChenLong <1300851984@qq.com> Date: Tue, 6 Jul 2021 13:08:17 +0800 Subject: [PATCH 4/4] fix xpu docs --- docs/api/paddle/device/XPUPlace_cn.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/api/paddle/device/XPUPlace_cn.rst b/docs/api/paddle/device/XPUPlace_cn.rst index 3c848f02c10..23d0aa37c07 100644 --- a/docs/api/paddle/device/XPUPlace_cn.rst +++ b/docs/api/paddle/device/XPUPlace_cn.rst @@ -18,12 +18,4 @@ XPUPlace **代码示例** -.. code-block:: python - - import paddle - - place = paddle.device.XPUPlace(0) - - - - +COPY-FROM: paddle.device.XPUPlace