Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
da24b77c
Commit
da24b77c
authored
May 15, 2018
by
Nick Korovaiko
Committed by
Scott Cyphers
May 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hooking up batchnorm kernels to cpu codegen (#1001)
parent
67078856
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
5 deletions
+33
-5
cpu_emitter.cpp
src/ngraph/runtime/cpu/cpu_emitter.cpp
+31
-2
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+1
-0
cpu_layout.cpp
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
+1
-1
unit_test.manifest
src/ngraph/runtime/cpu/unit_test.manifest
+0
-2
No files found.
src/ngraph/runtime/cpu/cpu_emitter.cpp
View file @
da24b77c
...
...
@@ -503,9 +503,38 @@ namespace ngraph
{
if
(
!
mkldnn_utils
::
use_mkldnn_kernel
(
node
))
{
throw
ngraph_error
(
"BatchNorm is only supported with 4-D MKLDNN kernel."
);
const
ngraph
::
op
::
BatchNorm
*
batchnorm
=
static_cast
<
const
ngraph
::
op
::
BatchNorm
*>
(
node
);
if
(
batchnorm
->
get_training_flag
()
&&
args
.
size
()
==
3
)
{
writer
<<
"reference::batch_norm_three_outputs("
<<
batchnorm
->
get_eps_value
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
0
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
1
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
2
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
out
[
0
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
out
[
1
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
out
[
2
].
get_name
()
<<
",
\n
"
;
writer
<<
" {"
<<
join
(
args
[
2
].
get_shape
())
<<
"});
\n
"
;
}
else
{
writer
<<
"reference::batch_norm_one_output("
<<
batchnorm
->
get_eps_value
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
0
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
1
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
2
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
3
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
args
[
4
].
get_name
()
<<
",
\n
"
;
writer
<<
" "
<<
out
[
0
].
get_name
()
<<
",
\n
"
;
writer
<<
" {"
<<
join
(
args
[
2
].
get_shape
())
<<
"});
\n
"
;
}
}
else
{
emitBatchNorm
(
external_function
,
writer
,
node
,
args
,
out
,
false
);
}
emitBatchNorm
(
external_function
,
writer
,
node
,
args
,
out
,
false
);
}
template
<>
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
da24b77c
...
...
@@ -351,6 +351,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
#include "ngraph/runtime/cpu/mkldnn_invoke.hpp"
#include "ngraph/runtime/reference/and.hpp"
#include "ngraph/runtime/reference/avg_pool.hpp"
#include "ngraph/runtime/reference/batch_norm.hpp"
#include "ngraph/runtime/reference/broadcast.hpp"
#include "ngraph/runtime/reference/concat.hpp"
#include "ngraph/runtime/reference/convolution.hpp"
...
...
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
View file @
da24b77c
...
...
@@ -1172,7 +1172,7 @@ namespace ngraph
}
else
{
throw
ngraph_error
(
"Batchnorm only supported in MKLDNN for now"
);
set_default_layouts
(
external_function
,
node
);
}
}
...
...
src/ngraph/runtime/cpu/unit_test.manifest
View file @
da24b77c
batch_norm_one_output
batch_norm_three_outputs
one_hot_matrix_0
one_hot_scalar_0_in_3
one_hot_scalar_1_in_3
...
...
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