Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
ddfd8ad3
Commit
ddfd8ad3
authored
Aug 02, 2018
by
Scott Thornton
Browse files
Formatting
parent
c3ec7238
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
src/targets/cpu/cpu_lowering.cpp
src/targets/cpu/cpu_lowering.cpp
+21
-16
No files found.
src/targets/cpu/cpu_lowering.cpp
View file @
ddfd8ad3
...
...
@@ -56,28 +56,33 @@ struct cpu_batch_norm_inference
auto
image_height
=
output_shape
.
lens
()[
2
];
auto
image_width
=
output_shape
.
lens
()[
3
];
if
(
op
.
bn_mode
==
batch_norm_inference
::
spatial
)
{
visit_all
(
output
,
input
,
mini_batch_mean
,
mini_batch_variance
,
arg_gamma
,
arg_bias
)(
[
&
](
auto
result
,
auto
buffer
,
auto
mean
,
auto
variance
,
auto
gamma
,
auto
bias
)
{
dfor
(
num_batch
,
num_channels
,
image_height
,
image_width
)(
[
&
](
std
::
size_t
n
,
std
::
size_t
c
,
std
::
size_t
h
,
std
::
size_t
w
)
{
result
(
n
,
c
,
h
,
w
)
=
gamma
(
c
)
*
(
buffer
(
n
,
c
,
h
,
w
)
-
mean
(
c
))
/
std
::
sqrt
(
variance
(
c
)
+
epsilon
)
+
bias
(
c
);
});
});
if
(
op
.
bn_mode
==
batch_norm_inference
::
spatial
)
{
visit_all
(
output
,
input
,
mini_batch_mean
,
mini_batch_variance
,
arg_gamma
,
arg_bias
)(
[
&
](
auto
result
,
auto
buffer
,
auto
mean
,
auto
variance
,
auto
gamma
,
auto
bias
)
{
dfor
(
num_batch
,
num_channels
,
image_height
,
image_width
)(
[
&
](
std
::
size_t
n
,
std
::
size_t
c
,
std
::
size_t
h
,
std
::
size_t
w
)
{
result
(
n
,
c
,
h
,
w
)
=
gamma
(
c
)
*
(
buffer
(
n
,
c
,
h
,
w
)
-
mean
(
c
))
/
std
::
sqrt
(
variance
(
c
)
+
epsilon
)
+
bias
(
c
);
});
});
}
if
(
op
.
bn_mode
==
batch_norm_inference
::
per_activation
)
{
if
(
op
.
bn_mode
==
batch_norm_inference
::
per_activation
)
{
visit_all
(
output
,
input
,
mini_batch_mean
,
mini_batch_mean
,
arg_gamma
,
arg_bias
)(
[
&
](
auto
result
,
auto
buffer
,
auto
mean
,
auto
variance
,
auto
gamma
,
auto
bias
)
{
dfor
(
num_batch
,
num_channels
,
image_height
,
image_width
)
(
dfor
(
num_batch
,
num_channels
,
image_height
,
image_width
)(
[
&
](
std
::
size_t
n
,
std
::
size_t
c
,
std
::
size_t
h
,
std
::
size_t
w
)
{
result
(
n
,
c
,
h
,
w
)
=
gamma
(
c
,
h
,
w
)
*
(
buffer
(
n
,
c
,
h
,
w
)
-
mean
(
c
,
h
,
w
))
/
std
::
sqrt
(
variance
(
c
,
h
,
w
)
+
epsilon
)
+
bias
(
c
,
h
,
w
);
});
});
result
(
n
,
c
,
h
,
w
)
=
gamma
(
c
,
h
,
w
)
*
(
buffer
(
n
,
c
,
h
,
w
)
-
mean
(
c
,
h
,
w
))
/
std
::
sqrt
(
variance
(
c
,
h
,
w
)
+
epsilon
)
+
bias
(
c
,
h
,
w
);
});
});
}
return
output
;
...
...
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