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.CosineDecayLR.rst 963 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334
  1. mindspore.nn.CosineDecayLR
  2. ===========================
  3. .. py:class:: mindspore.nn.CosineDecayLR(min_lr, max_lr, decay_steps)
  4. 基于余弦衰减函数计算学习率。
  5. 对于当前step,计算学习率的公式为:
  6. .. math::
  7. decayed\_learning\_rate = &min\_lr + 0.5 * (max\_lr - min\_lr) *\\
  8. &(1 + cos(\frac{current\_step}{decay\_steps}\pi))
  9. **参数:**
  10. - **min_lr** (float): 学习率的最小值。
  11. - **max_lr** (float): 学习率的最大值。
  12. - **decay_steps** (int): 进行衰减的step数。
  13. **输入:**
  14. - **global_step** (Tensor) - 当前step数,即current_step。
  15. **输出:**
  16. 标量Tensor。当前step的学习率值。
  17. **异常:**
  18. - **TypeError** - `min_lr` 或 `max_lr` 不是float。
  19. - **TypeError** - `decay_steps` 不是整数。
  20. - **ValueError** - `min_lr` 小于0或 `decay_steps` 小于1。
  21. - **ValueError** - `max_lr` 小于或等于0。