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.PolynomialDecayLR.rst 1.6 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. mindspore.nn.PolynomialDecayLR
  2. ====================================
  3. .. py:class:: mindspore.nn.PolynomialDecayLR(learning_rate, end_learning_rate, decay_steps, power, update_decay_steps=False)
  4. 基于多项式衰减函数计算学习率。
  5. 对于当前step,计算学习率的公式为:
  6. .. math::
  7. decayed\_learning\_rate = &(learning\_rate - end\_learning\_rate) *\\
  8. &(1 - tmp\_step / tmp\_decay\_steps)^{power}\\
  9. &+ end\_learning\_rate
  10. 其中,
  11. .. math::
  12. tmp\_step=min(current\_step, decay\_steps)
  13. 如果 `update_decay_steps` 为true,则每 `decay_steps` 更新 `tmp_decay_step` 的值。公式为:
  14. .. math::
  15. tmp\_decay\_steps = decay\_steps * ceil(current\_step / decay\_steps)
  16. **参数:**
  17. - **learning_rate** (float) - 学习率的初始值。
  18. - **end_learning_rate** (float) - 学习率的最终值。
  19. - **decay_steps** (int) - 进行衰减的step数。
  20. - **power** (float) - 多项式的幂,必须大于0。
  21. - **update_decay_steps** (bool) - 如果为True,则学习率每 `decay_steps` 次衰减一次。默认值:False。
  22. **输入:**
  23. - **global_step** (Tensor):当前step数,即current_step。
  24. **输出:**
  25. 标量Tensor。当前step的学习率值。
  26. **异常:**
  27. - **TypeError** - `learning_rate`, `end_learning_rate` 或 `power` 不是float。
  28. - **TypeError** - `decay_steps` 不是int或 `update_decay_steps` 不是bool。
  29. - **ValueError** - `end_learning_rate` 小于0或 `decay_steps` 小于1。
  30. - **ValueError** - `learning_rate` 或 `power` 小于或等于0。