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
a949bfa6
Commit
a949bfa6
authored
Apr 21, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speedup lr_mult=0 by skipping the gradient computation.
parent
b5a238a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
examples/cifar10-convnet.py
examples/cifar10-convnet.py
+1
-1
tensorpack/dataflow/prefetch.py
tensorpack/dataflow/prefetch.py
+1
-2
tensorpack/tfutils/gradproc.py
tensorpack/tfutils/gradproc.py
+7
-3
No files found.
examples/cifar10-convnet.py
View file @
a949bfa6
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File: cifar10
_
convnet.py
# File: cifar10
-
convnet.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import
tensorflow
as
tf
...
...
tensorpack/dataflow/prefetch.py
View file @
a949bfa6
...
...
@@ -49,8 +49,7 @@ class PrefetchData(ProxyDataFlow):
x
.
start
()
def
get_data
(
self
):
tot_cnt
=
0
for
_
in
range
(
tot_cnt
):
for
_
in
range
(
self
.
_size
):
dp
=
self
.
queue
.
get
()
yield
dp
...
...
tensorpack/tfutils/gradproc.py
View file @
a949bfa6
...
...
@@ -61,14 +61,18 @@ class ScaleGradient(GradientProcessor):
self
.
multipliers
=
multipliers
def
_process
(
self
,
grads
):
# TODO use None for zero can speed up (or not)?
ret
=
[]
for
grad
,
var
in
grads
:
varname
=
var
.
op
.
name
for
regex
,
val
in
self
.
multipliers
:
if
re
.
search
(
regex
,
varname
):
# always match against the whole name
if
not
regex
.
endswith
(
'$'
):
regex
=
regex
+
'$'
if
re
.
match
(
regex
,
varname
):
logger
.
info
(
"Apply lr multiplier {} for {}"
.
format
(
val
,
varname
))
ret
.
append
((
grad
*
val
,
var
))
if
val
!=
0
:
# skip zero to speed up
ret
.
append
((
grad
*
val
,
var
))
break
else
:
ret
.
append
((
grad
,
var
))
...
...
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