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
c5e05d7a
You need to sign in or sign up before continuing.
Commit
c5e05d7a
authored
Sep 16, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix colocation problems
parent
5d529d03
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
tensorpack/models/regularize.py
tensorpack/models/regularize.py
+3
-1
tensorpack/tfutils/gradproc.py
tensorpack/tfutils/gradproc.py
+1
-2
tensorpack/tfutils/summary.py
tensorpack/tfutils/summary.py
+2
-1
No files found.
tensorpack/models/regularize.py
View file @
c5e05d7a
...
...
@@ -47,12 +47,14 @@ def regularize_cost(regex, func, name='regularize_cost'):
# If vars are replicated, only regularize those in the current tower
params
=
ctx
.
filter_vars_by_vs_name
(
params
)
G
=
tf
.
get_default_graph
()
with
tf
.
name_scope
(
'regularize_cost'
):
costs
=
[]
for
p
in
params
:
para_name
=
p
.
name
if
re
.
search
(
regex
,
para_name
):
costs
.
append
(
func
(
p
))
with
G
.
colocate_with
(
p
):
costs
.
append
(
func
(
p
))
_log_regularizer
(
para_name
)
if
not
costs
:
return
tf
.
constant
(
0
,
dtype
=
tf
.
float32
,
name
=
'empty_'
+
name
)
...
...
tensorpack/tfutils/gradproc.py
View file @
c5e05d7a
...
...
@@ -128,8 +128,7 @@ class MapGradient(GradientProcessor):
for
grad
,
var
in
grads
:
if
re
.
match
(
self
.
regex
,
var
.
op
.
name
):
matched
=
True
with
tf
.
device
(
grad
.
device
):
grad
=
self
.
func
(
grad
,
var
)
grad
=
self
.
func
(
grad
,
var
)
if
grad
is
not
None
:
ret
.
append
((
grad
,
var
))
else
:
...
...
tensorpack/tfutils/summary.py
View file @
c5e05d7a
...
...
@@ -241,8 +241,9 @@ def add_moving_summary(*args, **kwargs):
ema_op
=
moving_averages
.
assign_moving_average
(
ema_var
,
c
,
decay
,
zero_debias
=
True
,
name
=
name
+
'_EMA_apply'
)
tf
.
summary
.
scalar
(
name
+
'-summary'
,
ema_op
)
# write the EMA value as a summary
ema_ops
.
append
(
ema_op
)
# cannot add it into colocate group -- will force everything to cpus
tf
.
summary
.
scalar
(
name
+
'-summary'
,
ema_op
)
# write the EMA value as a summary
if
coll
is
not
None
:
for
op
in
ema_ops
:
# TODO a new collection to summary every step?
...
...
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