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
07fcc56b
Commit
07fcc56b
authored
Jan 07, 2020
by
Tomasz Dołbniak
Committed by
Scott Cyphers
Jan 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use v1 ops in ONNX shrink (#4089)
Co-authored-by:
Scott Cyphers
<
diyessi@users.noreply.github.com
>
parent
972dd2f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
shrink.cpp
src/ngraph/frontend/onnx_import/op/shrink.cpp
+12
-10
No files found.
src/ngraph/frontend/onnx_import/op/shrink.cpp
View file @
07fcc56b
...
...
@@ -18,10 +18,6 @@
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/subtract.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "shrink.hpp"
namespace
ngraph
...
...
@@ -66,7 +62,7 @@ namespace ngraph
// by adding and subtracting bias
// All other values indicated by 'false' in the masks need to be zeroed out
std
::
shared_ptr
<
ngraph
::
Node
>
values_below_neg_lambd
=
std
::
make_shared
<
ngraph
::
opset0
::
Less
>
(
input
,
negative_lambd
);
std
::
make_shared
<
default_opset
::
Less
>
(
input
,
negative_lambd
);
std
::
shared_ptr
<
ngraph
::
Node
>
values_above_pos_lambd
=
std
::
make_shared
<
default_opset
::
Greater
>
(
input
,
positive_lambd
);
...
...
@@ -77,15 +73,21 @@ namespace ngraph
values_above_pos_lambd
=
std
::
make_shared
<
default_opset
::
Convert
>
(
values_above_pos_lambd
,
input_element_type
);
std
::
shared_ptr
<
ngraph
::
Node
>
input_minus_bias
=
input
-
bias_tensor
;
std
::
shared_ptr
<
ngraph
::
Node
>
input_plus_bias
=
input
+
bias_tensor
;
std
::
shared_ptr
<
ngraph
::
Node
>
input_minus_bias
=
std
::
make_shared
<
default_opset
::
Subtract
>
(
input
,
bias_tensor
);
std
::
shared_ptr
<
ngraph
::
Node
>
input_plus_bias
=
std
::
make_shared
<
default_opset
::
Add
>
(
input
,
bias_tensor
);
// multiply by the corresponding mask to zero-out the values within
// the <-lambd;lambd> range and keep the bias-adjusted values from outside of it
input_minus_bias
=
values_above_pos_lambd
*
input_minus_bias
;
input_plus_bias
=
values_below_neg_lambd
*
input_plus_bias
;
input_minus_bias
=
std
::
make_shared
<
default_opset
::
Multiply
>
(
values_above_pos_lambd
,
input_minus_bias
)
;
return
{
input_plus_bias
+
input_minus_bias
};
input_plus_bias
=
std
::
make_shared
<
default_opset
::
Multiply
>
(
values_below_neg_lambd
,
input_plus_bias
);
return
{
std
::
make_shared
<
default_opset
::
Add
>
(
input_plus_bias
,
input_minus_bias
)};
}
}
// namespace set_1
...
...
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