mindspore/docs/api/api_python/ops/mindspore.ops.ApplyAdadelta...

42 lines
2.6 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.ApplyAdadelta
============================
.. py:class:: mindspore.ops.ApplyAdadelta
根据Adadelta算法更新相关参数。
Adadelta算法具体细节可参考论文 `ADADELTA: AN ADAPTIVE LEARNING RATE METHOD <https://arxiv.org/abs/1212.5701>`_
.. math::
\begin{array}{ll} \\
\text{accum} = \rho * \text{accum} + (1 - \rho) * \text{grad}^2 \\
\text{update} = \sqrt{\text{accum_update} + \epsilon} * \frac{\text{grad}}{\sqrt{\text{accum} + \epsilon}} \\
\text{accum_update} = \rho * \text{accum_update} + (1 - \rho) * \text{update}^2 \\
\text{var} = \text{var} - \text{lr} * \text{update}
\end{array}
其中 :math:`\rho` 代表 `rho` :math:`\epsilon` 代表 `epsilon`
`var``accum``accum_update``grad` 的输入遵循隐式类型转换规则,使数据类型一致。如果它们具有不同的数据类型,则较低精度的数据类型将转换为相对最高精度的数据类型。
输入:
- **var** (Parameter) - 待更新的公式参数 var。数据类型为float32或float16。shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。
- **accum** (Parameter) - 待更新的公式参数 accumshape和数据类型与 `var` 相同。
- **accum_update** (Parameter) - 待更新的公式参数 accum_updateshape和数据类型与 `var` 相同。
- **lr** (Union[Number, Tensor]) - 学习率必须是Scalar。数据类型为float32或float16。
- **rho** (Union[Number, Tensor]) - :math:`\rho` 衰减率必须是Scalar。数据类型为float32或float16。
- **epsilon** (Union[Number, Tensor]) - :math:`\epsilon` 加在分母上的值以确保数值稳定必须是Scalar。数据类型为float32或float16。
- **grad** (Tensor) - 梯度shape和数据类型与 `var` 相同。
输出:
3个Tensor的元组更新后的数据。
- **var** (Tensor) - 与 `var` 相同的shape和数据类型。
- **accum** (Tensor)- 与 `accum` 相同的shape和数据类型。
- **accum_update** (Tensor) - 与 `accum_update` 相同的shape和数据类型。
异常:
- **TypeError** - 如果 `var``accum``accum_update``lr``rho``epsilon``grad` 的数据类型既不是float16也不是float32。
- **TypeError** - 如果 `accum_update``lr``rho``epsilon` 既不是数值型也不是Tensor。
- **RuntimeError** - 如果 `var``accum``accum_update``grad` 不支持数据类型转换。