You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.ExponentialDecayLR.rst 1.3 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. mindspore.nn.ExponentialDecayLR
  2. ================================
  3. .. py:class:: mindspore.nn.ExponentialDecayLR(learning_rate, decay_rate, decay_steps, is_stair=False)
  4. 基于指数衰减函数计算学习率。
  5. 对于当前step,计算学习率的公式为:
  6. .. math::
  7. decayed\_learning\_rate = learning\_rate * decay\_rate^{p}
  8. 其中,
  9. .. math::
  10. p = \frac{current\_step}{decay\_steps}
  11. 如果 `is_stair` 为True,则公式为:
  12. .. math::
  13. p = floor(\frac{current\_step}{decay\_steps})
  14. **参数:**
  15. - **learning_rate** (float): 学习率的初始值。
  16. - **decay_rate** (float): 衰减率。
  17. - **decay_steps** (int): 进行衰减的step数。
  18. - **is_stair** (bool): 如果为True,则学习率每 `decay_steps` 步衰减一次。默认值:False。
  19. **输入:**
  20. - **global_step** (Tensor) - 当前step数,即current_step。
  21. **输出:**
  22. 标量Tensor。当前step的学习率值。
  23. **异常:**
  24. - **TypeError** - `learning_rate` 或 `decay_rate` 不是float。
  25. - **TypeError** - `decay_steps` 不是int或 `is_stair` 不是bool。
  26. - **ValueError** - `decay_steps` 小于1。
  27. - **ValueError** - `learning_rate` 或 `decay_rate` 小于或等于0。