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
095c1cd9
Commit
095c1cd9
authored
Jul 26, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix repeated param restore
parent
2cd41e99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
tensorpack/tfutils/sessinit.py
tensorpack/tfutils/sessinit.py
+7
-4
No files found.
tensorpack/tfutils/sessinit.py
View file @
095c1cd9
...
...
@@ -110,6 +110,7 @@ class SaverRestore(SessionInit):
"""
vars_to_restore
=
tf
.
all_variables
()
var_dict
=
defaultdict
(
list
)
chkpt_vars_used
=
set
()
for
v
in
vars_to_restore
:
name
=
v
.
op
.
name
if
'towerp'
in
name
:
...
...
@@ -123,12 +124,14 @@ class SaverRestore(SessionInit):
name
=
name
[
len
(
self
.
prefix
)
+
1
:]
if
name
in
vars_available
:
var_dict
[
name
]
.
append
(
v
)
vars_available
.
remove
(
name
)
chkpt_vars_used
.
add
(
name
)
#vars_available.remove(name)
else
:
logger
.
warn
(
"Param {} not found in checkpoint! Will not restore."
.
format
(
v
.
op
.
name
))
# TODO warn if some variable in checkpoint is not used
#for name in vars_available:
#logger.warn("Param {} in checkpoint doesn't appear in the graph!".format(name))
if
len
(
chkpt_vars_used
)
<
len
(
vars_available
):
unused
=
vars_available
-
chkpt_vars_used
for
name
in
unused
:
logger
.
warn
(
"Param {} in checkpoint doesn't appear in the graph!"
.
format
(
name
))
return
var_dict
class
ParamRestore
(
SessionInit
):
...
...
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