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
8059ee40
You need to sign in or sign up before continuing.
Commit
8059ee40
authored
Aug 03, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check ModelDescBase instead of ModelDesc in PredictConfig (fix #361)
parent
930af0b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
tensorpack/predict/config.py
tensorpack/predict/config.py
+3
-3
tensorpack/tfutils/varmanip.py
tensorpack/tfutils/varmanip.py
+2
-5
No files found.
tensorpack/predict/config.py
View file @
8059ee40
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
import
tensorflow
as
tf
import
tensorflow
as
tf
import
six
import
six
from
..graph_builder
import
ModelDesc
from
..graph_builder
import
ModelDesc
Base
from
..tfutils
import
get_default_sess_config
from
..tfutils
import
get_default_sess_config
from
..tfutils.sessinit
import
SessionInit
,
JustCurrentSession
from
..tfutils.sessinit
import
SessionInit
,
JustCurrentSession
from
..tfutils.sesscreate
import
NewSessionCreator
from
..tfutils.sesscreate
import
NewSessionCreator
...
@@ -24,7 +24,7 @@ class PredictConfig(object):
...
@@ -24,7 +24,7 @@ class PredictConfig(object):
):
):
"""
"""
Args:
Args:
model (ModelDesc): the model to use.
model (ModelDesc
Base
): the model to use.
session_creator (tf.train.SessionCreator): how to create the
session_creator (tf.train.SessionCreator): how to create the
session. Defaults to :class:`sesscreate.NewSessionCreator()`.
session. Defaults to :class:`sesscreate.NewSessionCreator()`.
session_init (SessionInit): how to initialize variables of the session.
session_init (SessionInit): how to initialize variables of the session.
...
@@ -40,7 +40,7 @@ class PredictConfig(object):
...
@@ -40,7 +40,7 @@ class PredictConfig(object):
def
assert_type
(
v
,
tp
):
def
assert_type
(
v
,
tp
):
assert
isinstance
(
v
,
tp
),
v
.
__class__
assert
isinstance
(
v
,
tp
),
v
.
__class__
self
.
model
=
model
self
.
model
=
model
assert_type
(
self
.
model
,
ModelDesc
)
assert_type
(
self
.
model
,
ModelDesc
Base
)
if
session_init
is
None
:
if
session_init
is
None
:
session_init
=
JustCurrentSession
()
session_init
=
JustCurrentSession
()
...
...
tensorpack/tfutils/varmanip.py
View file @
8059ee40
...
@@ -191,11 +191,8 @@ def dump_chkpt_vars(model_path):
...
@@ -191,11 +191,8 @@ def dump_chkpt_vars(model_path):
def
is_training_name
(
name
):
def
is_training_name
(
name
):
"""
"""
Guess if a name belongs to a training-only variables
.
**Guess** if this variable is only used in training
.
Only used internally to avoid too many logging. Do not use it.
Only used internally to avoid too many logging. Do not use it.
Returns:
bool: Guess whether this tensor is something only used in training.
"""
"""
# TODO: maybe simply check against TRAINABLE_VARIABLES and MODEL_VARIABLES?
# TODO: maybe simply check against TRAINABLE_VARIABLES and MODEL_VARIABLES?
# TODO or use get_slot_names()
# TODO or use get_slot_names()
...
@@ -210,6 +207,6 @@ def is_training_name(name):
...
@@ -210,6 +207,6 @@ def is_training_name(name):
return
True
return
True
if
name
.
endswith
(
'/Adagrad'
):
if
name
.
endswith
(
'/Adagrad'
):
return
True
return
True
if
name
.
startswith
(
'
/EMA'
):
if
name
.
startswith
(
'
EMA/'
):
# all the moving average summaries
return
True
return
True
return
False
return
False
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