Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
7315d2cc
Commit
7315d2cc
authored
Jul 05, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix scheduled setter to work only at exact reach
parent
833fc5e2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
tensorpack/callbacks/param.py
tensorpack/callbacks/param.py
+10
-6
No files found.
tensorpack/callbacks/param.py
View file @
7315d2cc
...
@@ -225,7 +225,11 @@ class ScheduledHyperParamSetter(HyperParamSetter):
...
@@ -225,7 +225,11 @@ class ScheduledHyperParamSetter(HyperParamSetter):
to "val" **after** the completion of epoch `ep`.
to "val" **after** the completion of epoch `ep`.
If ep == 0, the value will be set before the first epoch
If ep == 0, the value will be set before the first epoch
(because by default the first is epoch 1).
(because by default the first is epoch 1).
interp: None: no interpolation. 'linear': linear interpolation
The epoch numbers have to be increasing.
interp (str or None): Either None or 'linear'.
If None, the parameter will only be set when the specific epoch or steps
is reached exactly. If 'linear', perform linear interpolation (but no extrapolation)
every time this callback is triggered.
step_based (bool): interpret ``schedule`` as (step, value) instead
step_based (bool): interpret ``schedule`` as (step, value) instead
of (epoch, value).
of (epoch, value).
...
@@ -248,17 +252,17 @@ class ScheduledHyperParamSetter(HyperParamSetter):
...
@@ -248,17 +252,17 @@ class ScheduledHyperParamSetter(HyperParamSetter):
laste
,
lastv
=
None
,
None
laste
,
lastv
=
None
,
None
for
e
,
v
in
self
.
schedule
:
for
e
,
v
in
self
.
schedule
:
if
e
==
refnum
:
if
e
==
refnum
:
return
v
return
v
# meet the exact boundary, return directly
if
e
>
refnum
:
if
e
>
refnum
:
break
break
laste
,
lastv
=
e
,
v
laste
,
lastv
=
e
,
v
if
laste
is
None
or
laste
==
e
:
if
laste
is
None
or
laste
==
e
:
# hasn't reached the first scheduled point, or reached the end of all scheduled points
# hasn't reached the first scheduled point, or reached the end of all scheduled points
return
None
return
None
if
self
.
interp
is
not
None
:
if
self
.
interp
is
None
:
# If no interpolation, nothing to do.
return
None
v
=
(
refnum
-
laste
)
*
1.
/
(
e
-
laste
)
*
(
v
-
lastv
)
+
lastv
v
=
(
refnum
-
laste
)
*
1.
/
(
e
-
laste
)
*
(
v
-
lastv
)
+
lastv
else
:
v
=
lastv
return
v
return
v
def
_trigger_epoch
(
self
):
def
_trigger_epoch
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment