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
57f542de
Commit
57f542de
authored
Aug 03, 2020
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`load_checkpoint_vars` supports npz
parent
43a44c1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
tensorpack/tfutils/varmanip.py
tensorpack/tfutils/varmanip.py
+5
-1
No files found.
tensorpack/tfutils/varmanip.py
View file @
57f542de
...
...
@@ -16,7 +16,7 @@ from .common import get_op_tensor_name
__all__
=
[
'SessionUpdate'
,
'dump_session_params'
,
'load_chkpt_vars'
,
'save_chkpt_vars'
,
'load_checkpoint_vars'
,
'save_checkpoint_vars'
,
'get_checkpoint_path'
]
'get_checkpoint_path'
,
'get_all_checkpoints'
]
def
get_savename_from_varname
(
...
...
@@ -251,6 +251,10 @@ def load_checkpoint_vars(path):
Returns:
dict: a name:value dict
"""
if
path
.
endswith
(
".npz"
):
ret
=
dict
(
np
.
load
(
path
))
ret
=
{
get_op_tensor_name
(
k
)[
0
]:
v
for
k
,
v
in
ret
.
items
()}
return
ret
path
=
get_checkpoint_path
(
path
)
reader
=
tfv1
.
train
.
NewCheckpointReader
(
path
)
var_names
=
reader
.
get_variable_to_shape_map
()
.
keys
()
...
...
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