Skip to content
Snippets Groups Projects
Unverified Commit 9d5b417f authored by Yixiao Fang's avatar Yixiao Fang Committed by GitHub
Browse files

[Fix] Fix T_max may be None in CosineAnnealingParamScheduler (#735)

parent d6f41bcf
No related branches found
No related tags found
No related merge requests found
...@@ -639,7 +639,7 @@ class CosineAnnealingParamScheduler(_ParamScheduler): ...@@ -639,7 +639,7 @@ class CosineAnnealingParamScheduler(_ParamScheduler):
@classmethod @classmethod
def build_iter_from_epoch(cls, def build_iter_from_epoch(cls,
*args, *args,
T_max, T_max=None,
begin=0, begin=0,
end=INF, end=INF,
by_epoch=True, by_epoch=True,
...@@ -653,7 +653,8 @@ class CosineAnnealingParamScheduler(_ParamScheduler): ...@@ -653,7 +653,8 @@ class CosineAnnealingParamScheduler(_ParamScheduler):
f'`epoch_length` must be a positive integer, ' \ f'`epoch_length` must be a positive integer, ' \
f'but got {epoch_length}.' f'but got {epoch_length}.'
by_epoch = False by_epoch = False
T_max = T_max * epoch_length if T_max is not None:
T_max = T_max * epoch_length
begin = int(begin * epoch_length) begin = int(begin * epoch_length)
if end != INF: if end != INF:
end = int(end * epoch_length) end = int(end * epoch_length)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment