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
249052e0
Commit
249052e0
authored
May 05, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add variable in batchrenorm. fix bug in CacheData
parent
b9e79e1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
tensorpack/dataflow/common.py
tensorpack/dataflow/common.py
+2
-1
tensorpack/models/batch_norm.py
tensorpack/models/batch_norm.py
+9
-3
No files found.
tensorpack/dataflow/common.py
View file @
249052e0
...
@@ -566,7 +566,8 @@ class CacheData(ProxyDataFlow):
...
@@ -566,7 +566,8 @@ class CacheData(ProxyDataFlow):
def
get_data
(
self
):
def
get_data
(
self
):
if
len
(
self
.
buffer
):
if
len
(
self
.
buffer
):
self
.
rng
.
shuffle
(
self
.
buffer
)
if
self
.
shuffle
:
self
.
rng
.
shuffle
(
self
.
buffer
)
for
dp
in
self
.
buffer
:
for
dp
in
self
.
buffer
:
yield
dp
yield
dp
else
:
else
:
...
...
tensorpack/models/batch_norm.py
View file @
249052e0
...
@@ -232,7 +232,6 @@ def BatchNorm(x, use_local_stat=None, decay=0.9, epsilon=1e-5,
...
@@ -232,7 +232,6 @@ def BatchNorm(x, use_local_stat=None, decay=0.9, epsilon=1e-5,
return
ret
return
ret
# TODO support NCHW
@
layer_register
(
log_shape
=
False
)
@
layer_register
(
log_shape
=
False
)
def
BatchRenorm
(
x
,
rmax
,
dmax
,
decay
=
0.9
,
epsilon
=
1e-5
,
def
BatchRenorm
(
x
,
rmax
,
dmax
,
decay
=
0.9
,
epsilon
=
1e-5
,
use_scale
=
True
,
use_bias
=
True
,
data_format
=
'NHWC'
):
use_scale
=
True
,
use_bias
=
True
,
data_format
=
'NHWC'
):
...
@@ -308,6 +307,13 @@ def BatchRenorm(x, rmax, dmax, decay=0.9, epsilon=1e-5,
...
@@ -308,6 +307,13 @@ def BatchRenorm(x, rmax, dmax, decay=0.9, epsilon=1e-5,
x
,
moving_mean
,
moving_var
,
beta
,
gamma
,
epsilon
)
x
,
moving_mean
,
moving_var
,
beta
,
gamma
,
epsilon
)
if
ctx
.
is_main_training_tower
:
if
ctx
.
is_main_training_tower
:
ret
urn
update_bn_ema
(
xn
,
batch_mean
,
batch_var
,
moving_mean
,
moving_var
,
decay
)
ret
=
update_bn_ema
(
xn
,
batch_mean
,
batch_var
,
moving_mean
,
moving_var
,
decay
)
else
:
else
:
return
tf
.
identity
(
xn
,
name
=
'output'
)
ret
=
tf
.
identity
(
xn
,
name
=
'output'
)
vh
=
ret
.
variables
=
VariableHolder
(
mean
=
moving_mean
,
variance
=
moving_var
)
if
use_scale
:
vh
.
gamma
=
gamma
if
use_bias
:
vh
.
beta
=
beta
return
ret
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