Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.tensorflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.learn.tensorflow
Commits
638290a3
Commit
638290a3
authored
6 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
New rule to shutdown gradient variables
parent
e12fdb85
No related branches found
No related tags found
1 merge request
!60
Style transfer
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/tensorflow/network/utils.py
+6
-1
6 additions, 1 deletion
bob/learn/tensorflow/network/utils.py
with
6 additions
and
1 deletion
bob/learn/tensorflow/network/utils.py
+
6
−
1
View file @
638290a3
...
@@ -22,7 +22,7 @@ def append_logits(graph,
...
@@ -22,7 +22,7 @@ def append_logits(graph,
reuse
=
reuse
)
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
Check if a variable is trainable or not
...
@@ -37,9 +37,14 @@ def is_trainable(name, trainable_variables):
...
@@ -37,9 +37,14 @@ def is_trainable(name, trainable_variables):
If None, the variable/scope is trained
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 None, we train by default
if
trainable_variables
is
None
:
if
trainable_variables
is
None
:
return
True
return
True
# Here is my choice to shutdown the whole scope
# Here is my choice to shutdown the whole scope
return
name
in
trainable_variables
return
name
in
trainable_variables
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment