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
c29c9f89
Unverified
Commit
c29c9f89
authored
Feb 22, 2018
by
Nick Korovaiko
Committed by
GitHub
Feb 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalize a ReLU pattern to fuse it in VGG (#529)
* generalize Relu * format fixes
parent
a6c86263
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
core_fusion.cpp
src/ngraph/pattern/core_fusion.cpp
+7
-2
No files found.
src/ngraph/pattern/core_fusion.cpp
View file @
c29c9f89
...
@@ -15,13 +15,13 @@
...
@@ -15,13 +15,13 @@
*******************************************************************************/
*******************************************************************************/
#include <algorithm>
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <unordered_set>
#include "ngraph/pattern/core_fusion.hpp"
#include "ngraph/pattern/core_fusion.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/log.hpp"
#include "ngraph/log.hpp"
#include "ngraph/ops/broadcast.hpp"
#include "ngraph/ops/constant.hpp"
#include "ngraph/ops/constant.hpp"
#include "ngraph/ops/maximum.hpp"
#include "ngraph/ops/maximum.hpp"
#include "ngraph/ops/parameter.hpp"
#include "ngraph/ops/parameter.hpp"
...
@@ -51,7 +51,12 @@ void pass::CoreFusion::construct_relu_pattern()
...
@@ -51,7 +51,12 @@ void pass::CoreFusion::construct_relu_pattern()
auto
iconst0
=
construct_constant_node
(
0
);
auto
iconst0
=
construct_constant_node
(
0
);
auto
val
=
make_shared
<
pattern
::
op
::
Label
>
(
iconst0
);
auto
val
=
make_shared
<
pattern
::
op
::
Label
>
(
iconst0
);
auto
zero
=
make_shared
<
pattern
::
op
::
Label
>
(
iconst0
,
nullptr
,
Nodes
{
iconst0
});
auto
zero
=
make_shared
<
pattern
::
op
::
Label
>
(
iconst0
,
nullptr
,
Nodes
{
iconst0
});
auto
max
=
make_shared
<
op
::
Maximum
>
(
zero
,
val
);
auto
broadcast_pred
=
[](
std
::
shared_ptr
<
Node
>
n
)
{
return
static_cast
<
bool
>
(
std
::
dynamic_pointer_cast
<
op
::
Broadcast
>
(
n
));
};
auto
skip_broadcast
=
std
::
make_shared
<
pattern
::
op
::
Any
>
(
zero
,
broadcast_pred
);
auto
max
=
make_shared
<
op
::
Maximum
>
(
skip_broadcast
,
val
);
pattern
::
gr_callback_fn
callback
=
[
val
,
zero
](
pattern
::
Matcher
&
m
)
{
pattern
::
gr_callback_fn
callback
=
[
val
,
zero
](
pattern
::
Matcher
&
m
)
{
NGRAPH_DEBUG
<<
"In a callback for construct_relu_pattern against "
NGRAPH_DEBUG
<<
"In a callback for construct_relu_pattern against "
...
...
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