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
53b6112d
You need to sign in or sign up before continuing.
Commit
53b6112d
authored
May 16, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better grad summary
parent
75e8d9fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
tensorpack/tfutils/gradproc.py
tensorpack/tfutils/gradproc.py
+4
-3
tensorpack/train/trainer.py
tensorpack/train/trainer.py
+2
-1
No files found.
tensorpack/tfutils/gradproc.py
View file @
53b6112d
...
...
@@ -6,7 +6,7 @@
import
tensorflow
as
tf
from
abc
import
ABCMeta
,
abstractmethod
import
re
from
..utils
import
logger
from
..utils
import
logger
,
MOVING_SUMMARY_VARS_KEY
__all__
=
[
'GradientProcessor'
,
'SummaryGradient'
,
'CheckGradient'
,
'ScaleGradient'
,
'MapGradient'
]
...
...
@@ -34,8 +34,9 @@ class SummaryGradient(GradientProcessor):
def
_process
(
self
,
grads
):
for
grad
,
var
in
grads
:
tf
.
histogram_summary
(
var
.
op
.
name
+
'/grad'
,
grad
)
tf
.
scalar_summary
(
var
.
op
.
name
+
'/gradRMS'
,
tf
.
sqrt
(
tf
.
reduce_mean
(
tf
.
square
(
grad
))))
tf
.
add_to_collection
(
MOVING_SUMMARY_VARS_KEY
,
tf
.
sqrt
(
tf
.
reduce_mean
(
tf
.
square
(
grad
)),
name
=
var
.
op
.
name
+
'/gradRMS'
))
return
grads
...
...
tensorpack/train/trainer.py
View file @
53b6112d
...
...
@@ -31,11 +31,12 @@ class SimpleTrainer(Trainer):
self
.
input_vars
=
input_vars
model
.
build_graph
(
input_vars
,
True
)
cost_var
=
model
.
get_cost
()
avg_maintain_op
=
summary_moving_average
(
)
tf
.
add_to_collection
(
MOVING_SUMMARY_VARS_KEY
,
cost_var
)
grads
=
self
.
config
.
optimizer
.
compute_gradients
(
cost_var
)
grads
=
self
.
process_grads
(
grads
)
avg_maintain_op
=
summary_moving_average
()
self
.
train_op
=
tf
.
group
(
self
.
config
.
optimizer
.
apply_gradients
(
grads
,
get_global_step_var
()),
avg_maintain_op
)
...
...
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