From 9a7724dc2f3e66074b6182aedbd4c5b0441c70cc Mon Sep 17 00:00:00 2001 From: zhangting2020 <709968123@qq.com> Date: Sun, 27 Sep 2020 02:17:53 +0000 Subject: [PATCH] modify doc --- python/paddle/__init__.py | 1 + python/paddle/device.py | 3 ++- python/paddle/fluid/framework.py | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index e749cf88b6a..4f308a98603 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -258,6 +258,7 @@ from .tensor.stat import numel #DEFINE_ALIAS from .device import get_cudnn_version from .device import set_device from .device import get_device +from .device import is_compiled_with_cuda # from .tensor.tensor import Tensor #DEFINE_ALIAS # from .tensor.tensor import LoDTensor #DEFINE_ALIAS # from .tensor.tensor import LoDTensorArray #DEFINE_ALIAS diff --git a/python/paddle/device.py b/python/paddle/device.py index de24fd87513..29e6f5a3df0 100644 --- a/python/paddle/device.py +++ b/python/paddle/device.py @@ -18,6 +18,7 @@ import re from paddle.fluid import core from paddle.fluid import framework from paddle.fluid.dygraph.parallel import ParallelEnv +from paddle.fluid.framework import is_compiled_with_cuda __all__ = [ 'get_cudnn_version', @@ -29,7 +30,7 @@ __all__ = [ # 'cuda_places', # 'CUDAPinnedPlace', # 'CUDAPlace', - # 'is_compiled_with_cuda' + 'is_compiled_with_cuda' ] _cudnn_version = None diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 797b32f5d47..c56644646df 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -350,13 +350,13 @@ def is_compiled_with_cuda(): """ Whether this whl package can be used to run the model on GPU. - Returns (bool): support gpu or not. + Returns (bool): `True` if CUDA is currently available, otherwise `False`. Examples: .. code-block:: python - import paddle.fluid as fluid - support_gpu = fluid.is_compiled_with_cuda() + import paddle + support_gpu = paddle.is_compiled_with_cuda() """ return core.is_compiled_with_cuda() -- GitLab