2.5K Star 8.4K Fork 4.7K

GVPMindSpore/mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindspore.nn.WarmUpLR.rst 947 Bytes
一键复制 编辑 原始数据 按行查看 历史
宦晓玲 提交于 2024-03-22 15:57 . modify the inconsistence 2.3

mindspore.nn.WarmUpLR

.. py:class:: mindspore.nn.WarmUpLR(learning_rate, warmup_steps)

    预热学习率。

    对于当前step,计算学习率的公式为:

    .. math::
        warmup\_learning\_rate = learning\_rate * tmp\_step / warmup\_steps

    其中,

    .. math::
        tmp\_step= \min(current\_step, warmup\_steps)

    参数:
        - **learning_rate** (float) - 学习率的初始值。
        - **warmup_steps** (int) - 学习率warmup的step数。

    输入:
        - **global_step** (Tensor) - 当前step数,即current_step。shape为 :math:`()`。

    输出:
        标量Tensor。当前step的学习率值,shape为 :math:`()`。

    异常:
        - **TypeError** - `learning_rate` 不是float。
        - **TypeError** - `warmup_steps` 不是int。
        - **ValueError** - `warmup_steps` 小于1。
        - **ValueError** - `learning_rate` 小于或等于0。
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
r2.3.q1

搜索帮助