From b89cea3367b34e72e38b662f583162fa165544ae Mon Sep 17 00:00:00 2001 From: yuchen202 <103028470+yuchen202@users.noreply.github.com> Date: Thu, 15 Dec 2022 16:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86API=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=9A=84=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9=20(#4905?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修改了API文档的相关内容 对weight_norm进行修改 * Update python/paddle/profiler/utils.py * Update python/paddle/utils/cpp_extension/cpp_extension.py * Update python/paddle/device/__init__.py * Update python/paddle/device/__init__.py * test=document_fix * for Hyperlink; test=document_fix * Update dlpack.py * test=document_fix Co-authored-by: Ligoml <39876205+Ligoml@users.noreply.github.com> --- python/paddle/device/__init__.py | 3 ++- python/paddle/device/cuda/__init__.py | 6 +++--- python/paddle/nn/utils/weight_norm_hook.py | 3 ++- python/paddle/profiler/utils.py | 2 +- python/paddle/utils/dlpack.py | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/python/paddle/device/__init__.py b/python/paddle/device/__init__.py index d961fbfdda..0673b36cbe 100644 --- a/python/paddle/device/__init__.py +++ b/python/paddle/device/__init__.py @@ -53,7 +53,8 @@ def is_compiled_with_npu(): """ Whether paddle was built with WITH_ASCEND_CL=ON to support Ascend NPU. - Returns (bool): `True` if NPU is supported, otherwise `False`. + Return: + bool, ``True`` if NPU is supported, otherwise ``False``. Examples: .. code-block:: python diff --git a/python/paddle/device/cuda/__init__.py b/python/paddle/device/cuda/__init__.py index 22ef453d08..188e334c2f 100644 --- a/python/paddle/device/cuda/__init__.py +++ b/python/paddle/device/cuda/__init__.py @@ -208,7 +208,7 @@ def max_memory_allocated(device=None): For instance, a float32 tensor with shape [1] in GPU will take up 256 bytes memory, even though storing a float32 data requires only 4 bytes. Args: - device(paddle.CUDAPlace or int or str): The device, the id of the device or + device(paddle.CUDAPlace or int or str, optional): The device, the id of the device or the string name of device like 'gpu:x'. If device is None, the device is the current device. Default: None. @@ -239,7 +239,7 @@ def max_memory_reserved(device=None): Return the peak size of GPU memory that is held by the allocator of the given device. Args: - device(paddle.CUDAPlace or int or str): The device, the id of the device or + device(paddle.CUDAPlace or int or str, optional): The device, the id of the device or the string name of device like 'gpu:x'. If device is None, the device is the current device. Default: None. @@ -396,7 +396,7 @@ def get_device_properties(device=None): Return the properties of given device. Args: - device(paddle.CUDAPlace or int or str): The device, the id of the device or + device(paddle.CUDAPlace or int or str, optional): The device, the id of the device or the string name of device like 'gpu:x' which to get the properties of the device from. If device is None, the device is the current device. Default: None. diff --git a/python/paddle/nn/utils/weight_norm_hook.py b/python/paddle/nn/utils/weight_norm_hook.py index ca06bee40d..ae797a3f2b 100644 --- a/python/paddle/nn/utils/weight_norm_hook.py +++ b/python/paddle/nn/utils/weight_norm_hook.py @@ -170,9 +170,10 @@ def weight_norm(layer, name='weight', dim=0): Weight normalization is a reparameterization of the weight vectors in a neural network that decouples the magnitude of those weight vectors from their direction. Weight normalization - replaces the parameter specified by `name`(eg: 'weight') with two parameters: one parameter + replaces the parameter specified by ``name`` (eg: 'weight') with two parameters: one parameter specifying the magnitude (eg: 'weight_g') and one parameter specifying the direction (eg: 'weight_v'). Weight normalization has been implemented as discussed in this paper: + `Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks `_. diff --git a/python/paddle/profiler/utils.py b/python/paddle/profiler/utils.py index e01add63e8..2d9fe94809 100644 --- a/python/paddle/profiler/utils.py +++ b/python/paddle/profiler/utils.py @@ -63,7 +63,7 @@ class RecordEvent(ContextDecorator): result = data1 + data2 record_event.end() - **Note**: + Note: RecordEvent will take effect only when :ref:`Profiler ` is on and at the state of `RECORD`. """ diff --git a/python/paddle/utils/dlpack.py b/python/paddle/utils/dlpack.py index beb37be453..af4f9fe6c9 100644 --- a/python/paddle/utils/dlpack.py +++ b/python/paddle/utils/dlpack.py @@ -69,7 +69,7 @@ def from_dlpack(dlpack): dlpack (PyCapsule): a PyCapsule object with the dltensor. Returns: - out (Tensor): a tensor decoded from DLPack. One thing to be noted, if we get + out (Tensor), a tensor decoded from DLPack. One thing to be noted, if we get an input dltensor with data type as `bool`, we return the decoded tensor as `uint8`. -- GitLab