未验证 提交 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
...@@ -178,12 +178,14 @@ class NaturalExpDecay(LearningRateDecay): ...@@ -178,12 +178,14 @@ class NaturalExpDecay(LearningRateDecay):
import paddle.fluid as fluid import paddle.fluid as fluid
base_lr = 0.1 base_lr = 0.1
with fluid.dygraph.guard(): with fluid.dygraph.guard():
emb = fluid.dygraph.Embedding([10, 10])
sgd_optimizer = fluid.optimizer.SGD( sgd_optimizer = fluid.optimizer.SGD(
learning_rate=fluid.dygraph.NaturalExpDecay( learning_rate=fluid.dygraph.NaturalExpDecay(
learning_rate=base_lr, learning_rate=base_lr,
decay_steps=10000, decay_steps=10000,
decay_rate=0.5, decay_rate=0.5,
staircase=True)) staircase=True),
parameter_list=emb.parameters())
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册