未验证 提交 a7cf5624 编写于 作者: Z Zhou Wei 提交者: GitHub

fix sample code error of fluid.dygraph.NaturalExpDecay,test=develop (#25092)

fix sample code error of fluid.dygraph.NaturalExpDecay
上级 2996315f
......@@ -175,15 +175,17 @@ class NaturalExpDecay(LearningRateDecay):
Examples:
.. code-block:: python
import paddle.fluid as fluid
base_lr = 0.1
with fluid.dygraph.guard():
sgd_optimizer = fluid.optimizer.SGD(
learning_rate=fluid.dygraph.NaturalExpDecay(
learning_rate=base_lr,
decay_steps=10000,
decay_rate=0.5,
staircase=True))
import paddle.fluid as fluid
base_lr = 0.1
with fluid.dygraph.guard():
emb = fluid.dygraph.Embedding([10, 10])
sgd_optimizer = fluid.optimizer.SGD(
learning_rate=fluid.dygraph.NaturalExpDecay(
learning_rate=base_lr,
decay_steps=10000,
decay_rate=0.5,
staircase=True),
parameter_list=emb.parameters())
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册