Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.tensorflow
Commits
638290a3
Commit
638290a3
authored
Jul 12, 2018
by
Tiago de Freitas Pereira
Browse files
New rule to shutdown gradient variables
parent
e12fdb85
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/learn/tensorflow/network/utils.py
View file @
638290a3
...
...
@@ -22,7 +22,7 @@ def append_logits(graph,
reuse
=
reuse
)
def
is_trainable
(
name
,
trainable_variables
):
def
is_trainable
(
name
,
trainable_variables
,
mode
=
tf
.
estimator
.
ModeKeys
.
TRAIN
):
"""
Check if a variable is trainable or not
...
...
@@ -37,9 +37,14 @@ def is_trainable(name, trainable_variables):
If None, the variable/scope is trained
"""
# if mode is not training, so we shutdown
if
mode
!=
tf
.
estimator
.
ModeKeys
.
TRAIN
:
return
False
# If None, we train by default
if
trainable_variables
is
None
:
return
True
# Here is my choice to shutdown the whole scope
return
name
in
trainable_variables
Write
Preview
Supports
Markdown
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