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
fb6981b8
Commit
fb6981b8
authored
Apr 03, 2018
by
Nick Korovaiko
Committed by
adstraw
Apr 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add layouts and a check for a single user (Relu) (#791)
* add layouts and users check * add convrelu handler
parent
015e1da8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
cpu_fusion.cpp
src/ngraph/runtime/cpu/pass/cpu_fusion.cpp
+6
-0
cpu_layout.cpp
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
+22
-0
No files found.
src/ngraph/runtime/cpu/pass/cpu_fusion.cpp
View file @
fb6981b8
...
@@ -806,6 +806,12 @@ void ngraph::runtime::cpu::pass::CPUFusion::construct_conv_relu()
...
@@ -806,6 +806,12 @@ void ngraph::runtime::cpu::pass::CPUFusion::construct_conv_relu()
return
false
;
return
false
;
}
}
if
(
conv
->
get_users
().
size
()
>
1
)
{
NGRAPH_DEBUG
<<
"Convolution has more than one user"
;
return
false
;
}
auto
conv_relu
=
std
::
shared_ptr
<
Node
>
(
new
op
::
ConvolutionRelu
(
conv
));
auto
conv_relu
=
std
::
shared_ptr
<
Node
>
(
new
op
::
ConvolutionRelu
(
conv
));
ngraph
::
replace_node
(
m
.
match_root
(),
conv_relu
);
ngraph
::
replace_node
(
m
.
match_root
(),
conv_relu
);
return
true
;
return
true
;
...
...
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
View file @
fb6981b8
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "ngraph/runtime/cpu/mkldnn_utils.hpp"
#include "ngraph/runtime/cpu/mkldnn_utils.hpp"
#include "ngraph/runtime/cpu/op/batch_norm_relu.hpp"
#include "ngraph/runtime/cpu/op/batch_norm_relu.hpp"
#include "ngraph/runtime/cpu/op/conv_bias.hpp"
#include "ngraph/runtime/cpu/op/conv_bias.hpp"
#include "ngraph/runtime/cpu/op/conv_relu.hpp"
#include "ngraph/runtime/cpu/op/convert_layout.hpp"
#include "ngraph/runtime/cpu/op/convert_layout.hpp"
#include "ngraph/runtime/cpu/op/sigmoid.hpp"
#include "ngraph/runtime/cpu/op/sigmoid.hpp"
...
@@ -347,6 +348,25 @@ namespace ngraph
...
@@ -347,6 +348,25 @@ namespace ngraph
}
}
}
}
template
<>
void
CPULayout
::
LAYOUT_DECL
(
ngraph
::
op
::
ConvolutionRelu
)
{
if
(
runtime
::
cpu
::
mkldnn_utils
::
use_mkldnn_kernel
(
node
.
get
()))
{
vector
<
memory
::
format
>
prim_input_formats
;
vector
<
memory
::
format
>
prim_output_formats
;
ConvolutionLayout
<
ngraph
::
op
::
ConvolutionRelu
,
false
>
(
node
,
prim_input_formats
,
prim_output_formats
);
node
=
insert_input_conversions
(
external_function
,
node
,
prim_input_formats
);
set_output_layouts
(
node
,
prim_output_formats
);
}
else
{
set_default_layouts
(
external_function
,
node
);
}
}
template
<>
template
<>
void
CPULayout
::
LAYOUT_DECL
(
ngraph
::
op
::
ConvolutionBackpropData
)
void
CPULayout
::
LAYOUT_DECL
(
ngraph
::
op
::
ConvolutionBackpropData
)
{
{
...
@@ -1170,6 +1190,8 @@ static const runtime::cpu::pass::LayoutOpMap s_dispatcher{
...
@@ -1170,6 +1190,8 @@ static const runtime::cpu::pass::LayoutOpMap s_dispatcher{
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
MaxPoolBackprop
>
},
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
MaxPoolBackprop
>
},
{
TI
(
ngraph
::
op
::
ConvolutionBias
),
{
TI
(
ngraph
::
op
::
ConvolutionBias
),
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
ConvolutionBias
>
},
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
ConvolutionBias
>
},
{
TI
(
ngraph
::
op
::
ConvolutionRelu
),
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
ConvolutionRelu
>
},
{
TI
(
ngraph
::
op
::
ConvolutionBiasBackpropFiltersBias
),
{
TI
(
ngraph
::
op
::
ConvolutionBiasBackpropFiltersBias
),
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
ConvolutionBiasBackpropFiltersBias
>
},
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
ConvolutionBiasBackpropFiltersBias
>
},
{
TI
(
ngraph
::
op
::
BatchNorm
),
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
BatchNorm
>
},
{
TI
(
ngraph
::
op
::
BatchNorm
),
&
runtime
::
cpu
::
pass
::
CPULayout
::
layout
<
ngraph
::
op
::
BatchNorm
>
},
...
...
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