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
108c9557
Commit
108c9557
authored
Dec 02, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix potential problems with varreplace.freeze_variables
parent
ae2bd873
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
tensorpack/tfutils/varreplace.py
tensorpack/tfutils/varreplace.py
+2
-1
No files found.
tensorpack/tfutils/varreplace.py
View file @
108c9557
...
...
@@ -52,8 +52,9 @@ def freeze_variables():
x = FullyConnected('fc', x, 1000) # fc/* will not be trained
"""
def
custom_getter
(
getter
,
*
args
,
**
kwargs
):
trainable
=
kwargs
.
get
(
'trainable'
,
True
)
v
=
getter
(
*
args
,
**
kwargs
)
if
kwargs
.
pop
(
'trainable'
,
True
)
:
if
trainable
:
v
=
tf
.
stop_gradient
(
v
)
return
v
return
custom_getter_scope
(
custom_getter
)
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