diff --git a/doc/fluid/api_cn/dygraph_cn/ExponentialDecay_cn.rst b/doc/fluid/api_cn/dygraph_cn/ExponentialDecay_cn.rst index 267b2455909ad8862d6332827fe8ed7215667958..bded6599257c7d35a6b92fbff6417589e12a0ea9 100644 --- a/doc/fluid/api_cn/dygraph_cn/ExponentialDecay_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/ExponentialDecay_cn.rst @@ -3,28 +3,44 @@ ExponentialDecay ------------------------------- -.. py:class:: paddle.fluid.dygraph.ExponentialDecay(learning_rate, decay_steps, decay_rate, staircase=False, begin=0, step=1, dtype='float32') +.. py:class:: paddle.fluid.dygraph.ExponentialDecay(learning_rate, decay_steps, decay_rate, staircase=False, begin=0, step=1, dtype=’float32‘) -对学习率应用指数衰减。 +该接口提供一种学习率按指数函数衰减的功能。 -在学习率上运用指数衰减。 -训练模型时,推荐在训练过程中降低学习率。每次 ``decay_steps`` 步骤中用 ``decay_rate`` 衰减学习率。 +指数衰减的计算方式如下。 -.. code-block:: text +.. math:: - if staircase == True: - decayed_learning_rate = learning_rate * decay_rate ^ floor(global_step / decay_steps) - else: - decayed_learning_rate = learning_rate * decay_rate ^ (global_step / decay_steps) + decayed\_learning\_rate = learning\_rate * decay\_rate ^ y + + +当staircase为False时,y对应的计算公式为: + +.. math:: + + y = \frac{global\_step}{decay\_steps} + +当staircase为True时,y对应的计算公式为: + +.. math:: + + y = math.floor(\frac{global\_step}{decay\_steps}) + +式中, + +- :math:`decayed\_learning\_rate` : 衰减后的学习率。 +式子中各参数详细介绍请看参数说明。 参数: - - **learning_rate** (Variable|float)-初始学习率 - - **decay_steps** (int)-见以上衰减运算 - - **decay_rate** (float)-衰减率。见以上衰减运算 - - **staircase** (Boolean)-若为True,按离散区间衰减学习率。默认:False - - **begin** (int) - 起始步,默认为0。 - - **step** (int) - 步大小,默认为1。 - - **dtype** (str) - 学习率的dtype,默认为‘float32’ + - **learning_rate** (Variable|float) - 初始学习率。如果类型为Variable,则为shape为[1]的Tensor,数据类型为float32或float64;也可以是python的float类型。 + - **decay_steps** (int) - 衰减步数。必须是正整数,该参数确定衰减周期。 + - **decay_rate** (float)- 衰减率。 + - **staircase** (bool) - 若为True,则以不连续的间隔衰减学习速率即阶梯型衰减。若为False,则以标准指数型衰减。默认值为False。 + - **begin** (int) - 起始步,即以上运算式子中global_step的初始化值。默认值为0。 + - **step** (int) - 步大小,即以上运算式子中global_step的每次的增量值,使得global_step随着训练的次数递增。默认值为1。 + - **dtype** (str) - 初始化学习率变量的数据类型,可以为"float32", "float64"。 默认值为"float32"。 + +返回: 无 **代码示例**