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
8915849e
Commit
8915849e
authored
Oct 29, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: persist collection order
parent
67de41d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
tensorpack/graph_builder/utils.py
tensorpack/graph_builder/utils.py
+2
-2
tensorpack/tfutils/collection.py
tensorpack/tfutils/collection.py
+3
-2
No files found.
tensorpack/graph_builder/utils.py
View file @
8915849e
...
@@ -134,10 +134,10 @@ def average_grads(all_grads):
...
@@ -134,10 +134,10 @@ def average_grads(all_grads):
for
grad_and_vars
in
zip
(
*
all_grads
):
for
grad_and_vars
in
zip
(
*
all_grads
):
# Ngpu * 2
# Ngpu * 2
v
=
grad_and_vars
[
0
][
1
]
v
=
grad_and_vars
[
0
][
1
]
all_
grads
=
[
g
for
(
g
,
_
)
in
grad_and_vars
]
grads
=
[
g
for
(
g
,
_
)
in
grad_and_vars
]
with
tf
.
device
(
v
.
device
):
# colocate summed grad with var
with
tf
.
device
(
v
.
device
):
# colocate summed grad with var
grad
=
tf
.
multiply
(
grad
=
tf
.
multiply
(
tf
.
add_n
(
all_
grads
),
1.0
/
nr_tower
)
tf
.
add_n
(
grads
),
1.0
/
nr_tower
)
ret
.
append
((
grad
,
v
))
ret
.
append
((
grad
,
v
))
return
ret
return
ret
tensorpack/tfutils/collection.py
View file @
8915849e
...
@@ -155,6 +155,7 @@ class CollectionGuard(object):
...
@@ -155,6 +155,7 @@ class CollectionGuard(object):
"""
"""
Get items from this collection that are added in the current tower.
Get items from this collection that are added in the current tower.
"""
"""
new
=
set
(
tf
.
get_collection
(
key
)
)
new
=
tf
.
get_collection
(
key
)
old
=
set
(
self
.
original
.
get
(
key
,
[]))
old
=
set
(
self
.
original
.
get
(
key
,
[]))
return
list
(
new
-
old
)
# presist the order in new
return
[
x
for
x
in
new
if
x
not
in
old
]
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