Skip to content

Commit

Permalink
docs: 修改 LRScheduler bug (#6324)
Browse files Browse the repository at this point in the history
诺姆衰减,相关算法请参考 《Attention Is All You Need》 ..改成 相关算法来源于...;中文文档增加方法介绍state_dict(),set_state_dict(state_dict)。
  • Loading branch information
Hhankyangg committed Nov 29, 2023
1 parent ffbded2 commit 5b556ce
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/api/paddle/optimizer/lr/LRScheduler_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LRScheduler

目前在 paddle 中基于该基类,已经实现了 14 种策略,分别为:

* :code:`NoamDecay`:诺姆衰减,相关算法请参考 `《Attention Is All You Need》 <https://arxiv.org/pdf/1706.03762.pdf>`_ 。请参考 :ref:`cn_api_paddle_optimizer_lr_NoamDecay`。
* :code:`NoamDecay`:诺姆衰减,相关算法来源于 `《Attention Is All You Need》 <https://arxiv.org/pdf/1706.03762.pdf>`_ 。请参考 :ref:`cn_api_paddle_optimizer_lr_NoamDecay`。

* :code:`ExponentialDecay`:指数衰减,即每次将当前学习率乘以给定的衰减率得到下一个学习率。请参考 :ref:`cn_api_paddle_optimizer_lr_ExponentialDecay`。

Expand Down Expand Up @@ -88,10 +88,20 @@ get_lr()

上述给出了实现 ``StepLR`` 的一个简单示例。

_state_keys()
state_keys()
'''''''''

该函数通过定义字典 ``self.keys`` 来设置 ``optimizer.state_dict()`` 时的存储对象,默认情况下:``self.keys=['last_epoch', 'last_lr']``,其中 ``last_epoch``
是当前的 epoch 数,``last_lr`` 是当前的学习率值。

如果需要改变默认的行为,用户需要重写该方法,来重新定义字典 ``self.keys``,一般无需重新设置。

state_dict()
'''''''''

以 ``dict`` 形式返回调度器的状态。

set_state_dict(state_dict)
'''''''''

加载调度器状态。

0 comments on commit 5b556ce

Please sign in to comment.