Skip to content

Commit a219f3c

Browse files
committed
follow comments
1 parent 4a0f374 commit a219f3c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

python/paddle/fluid/layers/learning_rate_scheduler.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@ def polynomial_decay(learning_rate,
209209
def piecewise_decay(boundaries, values):
210210
"""Applies piecewise decay to the initial learning rate.
211211
212+
The algorithm can be described as the code below.
213+
214+
.. code-block:: python
215+
216+
boundaries = [10000, 20000]
217+
values = [1.0, 0.5, 0.1]
218+
if step < 10000:
219+
learning_rate = 1.0
220+
elif 10000 <= step < 20000:
221+
learning_rate = 0.5
222+
else:
223+
learning_rate = 0.1
212224
Args:
213225
boundaries: A list of steps numbers.
214226
values: A list of learning rate values that will be picked during
@@ -217,15 +229,7 @@ def piecewise_decay(boundaries, values):
217229
Returns:
218230
The decayed learning rate.
219231
220-
>>> boundaries = [10000, 20000]
221-
>>> values = [1.0, 0.5, 0.1]
222-
>>>
223-
>>> if step < 10000:
224-
>>> learning_rate = 1.0
225-
>>> elif 10000 <= step < 20000:
226-
>>> learning_rate = 0.5
227-
>>> else:
228-
>>> learning_rate = 0.1
232+
229233
"""
230234

231235
if len(values) - len(boundaries) != 1:

0 commit comments

Comments
 (0)