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
d4c5c4f4
Commit
d4c5c4f4
authored
Jun 28, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more fixes on old usage of add_moving_summary (#805)
parent
c84b6c24
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
examples/HED/hed.py
examples/HED/hed.py
+1
-1
examples/ImageNetModels/inception-bn.py
examples/ImageNetModels/inception-bn.py
+1
-1
tensorpack/tfutils/summary.py
tensorpack/tfutils/summary.py
+4
-1
No files found.
examples/HED/hed.py
View file @
d4c5c4f4
...
...
@@ -115,7 +115,7 @@ class Model(ModelDesc):
add_param_summary
((
'.*/W'
,
[
'histogram'
]))
# monitor W
total_cost
=
tf
.
add_n
(
costs
,
name
=
'cost'
)
add_moving_summary
(
*
(
costs
+
[
wrong
,
total_cost
])
)
add_moving_summary
(
wrong
,
total_cost
,
*
costs
)
return
total_cost
def
optimizer
(
self
):
...
...
examples/ImageNetModels/inception-bn.py
View file @
d4c5c4f4
...
...
@@ -96,7 +96,7 @@ class Model(ModelDesc):
loss3
=
tf
.
reduce_mean
(
loss3
,
name
=
'loss3'
)
cost
=
tf
.
add_n
([
loss3
,
0.3
*
loss2
,
0.3
*
loss1
],
name
=
'weighted_cost'
)
add_moving_summary
(
[
cost
,
loss1
,
loss2
,
loss3
]
)
add_moving_summary
(
cost
,
loss1
,
loss2
,
loss3
)
def
prediction_incorrect
(
logits
,
label
,
topk
,
name
):
return
tf
.
cast
(
tf
.
logical_not
(
tf
.
nn
.
in_top_k
(
logits
,
label
,
topk
)),
tf
.
float32
,
name
=
name
)
...
...
tensorpack/tfutils/summary.py
View file @
d4c5c4f4
...
...
@@ -196,7 +196,6 @@ def add_param_summary(*summary_lists, **kwargs):
add_tensor_summary
(
p
,
actions
,
name
=
name
,
collections
=
collections
)
# TODO: collection for the summary op
def
add_moving_summary
(
*
args
,
**
kwargs
):
"""
Summarize the moving average for scalar tensors.
...
...
@@ -228,6 +227,10 @@ def add_moving_summary(*args, **kwargs):
logger
.
warn
(
"add_moving_summary() called under reuse=True scope, ignored."
)
return
[]
if
len
(
args
)
==
1
and
isinstance
(
args
[
0
],
(
list
,
tuple
)):
logger
.
warn
(
"add_moving_summary() takes positional args instead of an iterable of tensors!"
)
args
=
args
[
0
]
for
x
in
args
:
assert
isinstance
(
x
,
(
tf
.
Tensor
,
tf
.
Variable
)),
x
assert
x
.
get_shape
()
.
ndims
==
0
,
\
...
...
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