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

fix sample code error of fluid.dygraph.NaturalExpDecay,test=release/1.8 (#25093)

fix sample code error of fluid.dygraph.NaturalExpDecay
上级 12f64401
...@@ -171,15 +171,18 @@ class NaturalExpDecay(LearningRateDecay): ...@@ -171,15 +171,18 @@ class NaturalExpDecay(LearningRateDecay):
Examples: Examples:
.. code-block:: python .. code-block:: python
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():
sgd_optimizer = fluid.optimizer.SGD( emb = fluid.dygraph.Embedding([10, 10])
learning_rate=fluid.dygraph.NaturalExpDecay( sgd_optimizer = fluid.optimizer.SGD(
learning_rate=base_lr, learning_rate=fluid.dygraph.NaturalExpDecay(
decay_steps=10000, learning_rate=base_lr,
decay_rate=0.5, decay_steps=10000,
staircase=True)) 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.
先完成此消息的编辑!
想要评论请 注册