Skip to content

修复 paddle\nn\layer\norm 等 API 的文档 #6176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/paddle/Tensor_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tensor
.. py:class:: paddle.Tensor


``Tensor`` 是 Paddle 中最为基础的数据结构,有几种创建 Tensor 的不同方式:
``Tensor`` 是 Paddle 中最为基础的数据结构,更多详情请参考:有几种创建 Tensor 的不同方式:

- 用预先存在的 ``data`` 数据创建 1 个 Tensor,请参考 :ref:`cn_api_paddle_to_tensor`
- 创建一个指定 ``shape`` 的 Tensor,请参考 :ref:`cn_api_tensor_ones` 、 :ref:`cn_api_tensor_zeros`、 :ref:`cn_api_tensor_full`
Expand Down
2 changes: 1 addition & 1 deletion docs/api/paddle/arange_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ arange

返回以步长 ``step`` 均匀分隔给定数值区间[ ``start`` , ``end`` )的 1-D Tensor,数据类型为 ``dtype`` 。

当 ``dtype`` 表示浮点类型时,为了避免浮点计算误差,建议给 ``end`` 加上一个极小值 epsilon,使边界可以更加明确。
当 ``dtype`` 表示浮点类型时,为了避免浮点计算误差,建议给 ``end`` 减去一个极小值 epsilon,使边界可以更加明确。

参数
::::::::::
Expand Down
13 changes: 8 additions & 5 deletions docs/api/paddle/optimizer/Momentum_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ Momentum
参数
::::::::::::

- **learning_rate** (float|_LRScheduler,可选) - 学习率,用于参数更新的计算。可以是一个浮点型值或者一个_LRScheduler ,默认值为 0.001。
- **momentum** (float,可选) - 动量因子。
- **parameters** (list,可选) - 指定优化器需要优化的参数。在动态图模式下必须提供该参数在静态图模式下默认值为 None,这时所有的参数都将被优化。
- **learning_rate** (float|_LRScheduler,可选) - 学习率,用于参数更新的计算。可以是一个浮点型值或者一个_LRScheduler 类的 tensor ,默认值为 0.001。
- **momentum** (float,可选) - 动量因子。默认值为0.001。
- **parameters** (list|tuple,可选) - 指定优化器需要优化的参数。在动态图模式下必须提供该参数。您可以为不同的参数组指定不同的选项,如学习率,权重衰减等,参数是dict的列表。注意,参数组中的learning_rate表示基础值的learning_rate。在静态图模式下默认值为 None,这时所有的参数都将被优化。
- **use_nesterov** (bool,可选) - 赋能牛顿动量,默认值 False。
- **weight_decay** (float|Tensor,可选) - 权重衰减系数,是一个 float 类型或者 shape 为[1],数据类型为 float32 的 Tensor 类型。默认值为 0.01。
- **grad_clip** (GradientClipBase,可选) – 梯度裁剪的策略,支持三种裁剪策略::ref:`paddle.nn.ClipGradByGlobalNorm <cn_api_fluid_clip_ClipGradByGlobalNorm>` 、 :ref:`paddle.nn.ClipGradByNorm <cn_api_fluid_clip_ClipGradByNorm>` 、 :ref:`paddle.nn.ClipGradByValue <cn_api_fluid_clip_ClipGradByValue>` 。
- **grad_clip** (GradientClipBase,可选) – 梯度裁剪的策略,支持三种裁剪策略::ref:`paddle.nn.ClipGradByGlobalNorm <cn_api_paddle_nn_ClipGradByGlobalNorm>` 、 :ref:`paddle.nn.ClipGradByNorm <cn_api_paddle_nn_ClipGradByNorm>` 、 :ref:`paddle.nn.ClipGradByValue <cn_api_paddle_nn_ClipGradByValue>` 。
默认值为 None,此时将不进行梯度裁剪。
- **multi_precision** (bool,可选) - 在权重更新时是否使用多精度。默认值 False。
- **rescale_grad**(float,可选) - 用梯度 rescale_grad 之前更新。通常选择为1.0/batch_size。
- **use_multi_tensor** (bool,可选) - 是否使用 multi-tensor 策略一次性更新所有参数。默认值 False。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。


Expand Down Expand Up @@ -100,7 +103,7 @@ set_lr(value)

.. note::

该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html>`_ 模式下生效。
该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html>`_ 模式下生效。在优化器中手动设置学习率的值。如果优化器使用LRScheduler,不能调用此API,因为它会导致冲突。

set_lr_scheduler(scheduler)
'''''''''
Expand Down