File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
python/paddle/fluid/dygraph Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -171,15 +171,18 @@ class NaturalExpDecay(LearningRateDecay):
171
171
Examples:
172
172
.. code-block:: python
173
173
174
- import paddle.fluid as fluid
175
- base_lr = 0.1
176
- with fluid.dygraph.guard():
177
- sgd_optimizer = fluid.optimizer.SGD(
178
- learning_rate=fluid.dygraph.NaturalExpDecay(
179
- learning_rate=base_lr,
180
- decay_steps=10000,
181
- decay_rate=0.5,
182
- staircase=True))
174
+ import paddle.fluid as fluid
175
+ base_lr = 0.1
176
+ with fluid.dygraph.guard():
177
+ emb = fluid.dygraph.Embedding([10, 10])
178
+ sgd_optimizer = fluid.optimizer.SGD(
179
+ learning_rate=fluid.dygraph.NaturalExpDecay(
180
+ learning_rate=base_lr,
181
+ decay_steps=10000,
182
+ decay_rate=0.5,
183
+ staircase=True),
184
+ parameter_list=emb.parameters())
185
+
183
186
184
187
"""
185
188
You can’t perform that action at this time.
0 commit comments