提交 353c3f51 编写于 作者: G gaotingquan 提交者: Tingquan Gao

debug: when using Piecewise.learning_rate while total epochs < 30

上级 4247fac8
......@@ -406,11 +406,17 @@ class Piecewise(LRBase):
learning_rate=None,
**kwargs):
if learning_rate:
decay_epochs = list(range(0, epochs, 30))[1:]
decay_epochs = list(range(0, epochs, 30))
values = [
learning_rate * (0.1**i)
for i in range(len(decay_epochs) + 1)
learning_rate * (0.1**i) for i in range(len(decay_epochs))
]
# when total epochs < 30, decay_epochs and values should be
# [] and [lr] respectively, but paddle dont support.
if len(decay_epochs) == 1:
decay_epochs = [epochs]
values = [values[0], values[0]]
else:
decay_epochs = decay_epochs[1:]
logger.warning(
"When 'learning_rate' of Piecewise has beed set, "
"the learning rate scheduler would be set by the rule that lr decay 10 times every 30 epochs. "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册