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
d33698fa
Commit
d33698fa
authored
Dec 13, 2019
by
Katarzyna Mitrus
Committed by
Michał Karzyński
Dec 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ONNX importer to use nGraph ops from new opset header (#3994)
parent
04ea0671
Show whitespace changes
Inline
Side-by-side
Showing
98 changed files
with
484 additions
and
384 deletions
+484
-384
CMakeLists.txt
src/ngraph/frontend/onnx_import/CMakeLists.txt
+2
-0
default_opset.hpp
src/ngraph/frontend/onnx_import/default_opset.hpp
+9
-0
abs.hpp
src/ngraph/frontend/onnx_import/op/abs.hpp
+2
-2
acos.hpp
src/ngraph/frontend/onnx_import/op/acos.hpp
+2
-2
acosh.cpp
src/ngraph/frontend/onnx_import/op/acosh.cpp
+4
-6
add.cpp
src/ngraph/frontend/onnx_import/op/add.cpp
+59
-0
add.hpp
src/ngraph/frontend/onnx_import/op/add.hpp
+2
-18
and.hpp
src/ngraph/frontend/onnx_import/op/and.hpp
+2
-1
argmax.cpp
src/ngraph/frontend/onnx_import/op/argmax.cpp
+2
-2
argmin.cpp
src/ngraph/frontend/onnx_import/op/argmin.cpp
+2
-2
asin.hpp
src/ngraph/frontend/onnx_import/op/asin.hpp
+2
-1
asinh.cpp
src/ngraph/frontend/onnx_import/op/asinh.cpp
+4
-6
atan.hpp
src/ngraph/frontend/onnx_import/op/atan.hpp
+2
-2
atanh.cpp
src/ngraph/frontend/onnx_import/op/atanh.cpp
+5
-6
batch_norm.cpp
src/ngraph/frontend/onnx_import/op/batch_norm.cpp
+5
-4
cast.cpp
src/ngraph/frontend/onnx_import/op/cast.cpp
+2
-2
ceil.hpp
src/ngraph/frontend/onnx_import/op/ceil.hpp
+2
-2
clip.cpp
src/ngraph/frontend/onnx_import/op/clip.cpp
+5
-8
concat.cpp
src/ngraph/frontend/onnx_import/op/concat.cpp
+2
-1
constant.cpp
src/ngraph/frontend/onnx_import/op/constant.cpp
+17
-15
conv.cpp
src/ngraph/frontend/onnx_import/op/conv.cpp
+6
-9
conv_integer.cpp
src/ngraph/frontend/onnx_import/op/conv_integer.cpp
+5
-5
conv_transpose.cpp
src/ngraph/frontend/onnx_import/op/conv_transpose.cpp
+4
-3
cum_sum.cpp
src/ngraph/frontend/onnx_import/op/cum_sum.cpp
+5
-4
depth_to_space.cpp
src/ngraph/frontend/onnx_import/op/depth_to_space.cpp
+6
-5
dequantize_linear.cpp
src/ngraph/frontend/onnx_import/op/dequantize_linear.cpp
+5
-3
div.hpp
src/ngraph/frontend/onnx_import/op/div.hpp
+5
-3
elu.cpp
src/ngraph/frontend/onnx_import/op/elu.cpp
+2
-3
equal.hpp
src/ngraph/frontend/onnx_import/op/equal.hpp
+2
-3
erf.hpp
src/ngraph/frontend/onnx_import/op/erf.hpp
+2
-2
exp.hpp
src/ngraph/frontend/onnx_import/op/exp.hpp
+2
-2
expand.cpp
src/ngraph/frontend/onnx_import/op/expand.cpp
+3
-2
floor.hpp
src/ngraph/frontend/onnx_import/op/floor.hpp
+2
-1
gather.hpp
src/ngraph/frontend/onnx_import/op/gather.hpp
+3
-3
gather_nd.cpp
src/ngraph/frontend/onnx_import/op/gather_nd.cpp
+2
-2
gemm.cpp
src/ngraph/frontend/onnx_import/op/gemm.cpp
+14
-13
greater.hpp
src/ngraph/frontend/onnx_import/op/greater.hpp
+2
-1
hard_sigmoid.cpp
src/ngraph/frontend/onnx_import/op/hard_sigmoid.cpp
+4
-7
hardmax.cpp
src/ngraph/frontend/onnx_import/op/hardmax.cpp
+3
-4
instance_norm.cpp
src/ngraph/frontend/onnx_import/op/instance_norm.cpp
+6
-6
leaky_relu.cpp
src/ngraph/frontend/onnx_import/op/leaky_relu.cpp
+4
-3
less.hpp
src/ngraph/frontend/onnx_import/op/less.hpp
+2
-1
log_softmax.cpp
src/ngraph/frontend/onnx_import/op/log_softmax.cpp
+2
-2
lp_norm.cpp
src/ngraph/frontend/onnx_import/op/lp_norm.cpp
+2
-2
lp_pool.cpp
src/ngraph/frontend/onnx_import/op/lp_pool.cpp
+4
-2
lrn.cpp
src/ngraph/frontend/onnx_import/op/lrn.cpp
+2
-2
lstm.cpp
src/ngraph/frontend/onnx_import/op/lstm.cpp
+17
-13
matmul.hpp
src/ngraph/frontend/onnx_import/op/matmul.hpp
+2
-2
max.hpp
src/ngraph/frontend/onnx_import/op/max.hpp
+4
-3
mean.cpp
src/ngraph/frontend/onnx_import/op/mean.cpp
+6
-4
mean_variance_normalization.cpp
...h/frontend/onnx_import/op/mean_variance_normalization.cpp
+3
-2
min.hpp
src/ngraph/frontend/onnx_import/op/min.hpp
+4
-3
mod.cpp
src/ngraph/frontend/onnx_import/op/mod.cpp
+2
-1
mul.hpp
src/ngraph/frontend/onnx_import/op/mul.hpp
+5
-3
non_max_suppression.cpp
src/ngraph/frontend/onnx_import/op/non_max_suppression.cpp
+9
-8
not.hpp
src/ngraph/frontend/onnx_import/op/not.hpp
+2
-2
onehot.cpp
src/ngraph/frontend/onnx_import/op/onehot.cpp
+10
-9
or.hpp
src/ngraph/frontend/onnx_import/op/or.hpp
+3
-4
pad.cpp
src/ngraph/frontend/onnx_import/op/pad.cpp
+5
-4
pow.hpp
src/ngraph/frontend/onnx_import/op/pow.hpp
+2
-2
prelu.cpp
src/ngraph/frontend/onnx_import/op/prelu.cpp
+2
-2
quant_conv.cpp
src/ngraph/frontend/onnx_import/op/quant_conv.cpp
+7
-8
quantize_linear.cpp
src/ngraph/frontend/onnx_import/op/quantize_linear.cpp
+3
-3
reciprocal.cpp
src/ngraph/frontend/onnx_import/op/reciprocal.cpp
+2
-2
reduce.cpp
src/ngraph/frontend/onnx_import/op/reduce.cpp
+4
-5
reduce.hpp
src/ngraph/frontend/onnx_import/op/reduce.hpp
+13
-10
relu.hpp
src/ngraph/frontend/onnx_import/op/relu.hpp
+2
-2
reshape.cpp
src/ngraph/frontend/onnx_import/op/reshape.cpp
+3
-4
reverse_sequence.cpp
src/ngraph/frontend/onnx_import/op/reverse_sequence.cpp
+3
-4
selu.cpp
src/ngraph/frontend/onnx_import/op/selu.cpp
+4
-5
shape.cpp
src/ngraph/frontend/onnx_import/op/shape.cpp
+2
-2
shrink.cpp
src/ngraph/frontend/onnx_import/op/shrink.cpp
+11
-13
sigmoid.hpp
src/ngraph/frontend/onnx_import/op/sigmoid.hpp
+2
-2
sign.hpp
src/ngraph/frontend/onnx_import/op/sign.hpp
+2
-2
sin.hpp
src/ngraph/frontend/onnx_import/op/sin.hpp
+2
-2
sinh.hpp
src/ngraph/frontend/onnx_import/op/sinh.hpp
+2
-2
size.cpp
src/ngraph/frontend/onnx_import/op/size.cpp
+2
-2
slice.cpp
src/ngraph/frontend/onnx_import/op/slice.cpp
+3
-2
softmax.cpp
src/ngraph/frontend/onnx_import/op/softmax.cpp
+2
-2
softplus.cpp
src/ngraph/frontend/onnx_import/op/softplus.cpp
+12
-13
softsign.cpp
src/ngraph/frontend/onnx_import/op/softsign.cpp
+4
-3
space_to_depth.cpp
src/ngraph/frontend/onnx_import/op/space_to_depth.cpp
+3
-3
split.cpp
src/ngraph/frontend/onnx_import/op/split.cpp
+5
-7
sqrt.hpp
src/ngraph/frontend/onnx_import/op/sqrt.hpp
+2
-2
squeeze.cpp
src/ngraph/frontend/onnx_import/op/squeeze.cpp
+2
-2
sub.hpp
src/ngraph/frontend/onnx_import/op/sub.hpp
+5
-4
sum.hpp
src/ngraph/frontend/onnx_import/op/sum.hpp
+4
-3
tan.hpp
src/ngraph/frontend/onnx_import/op/tan.hpp
+2
-2
tanh.hpp
src/ngraph/frontend/onnx_import/op/tanh.hpp
+2
-2
thresholded_relu.cpp
src/ngraph/frontend/onnx_import/op/thresholded_relu.cpp
+6
-7
topk.cpp
src/ngraph/frontend/onnx_import/op/topk.cpp
+16
-15
unsqueeze.cpp
src/ngraph/frontend/onnx_import/op/unsqueeze.cpp
+3
-4
where.hpp
src/ngraph/frontend/onnx_import/op/where.hpp
+2
-2
xor.hpp
src/ngraph/frontend/onnx_import/op/xor.hpp
+2
-2
common.cpp
src/ngraph/frontend/onnx_import/utils/common.cpp
+3
-1
common.hpp
src/ngraph/frontend/onnx_import/utils/common.hpp
+3
-3
pooling_factory.cpp
src/ngraph/frontend/onnx_import/utils/pooling_factory.cpp
+3
-2
opset0.hpp
src/ngraph/opsets/opset0.hpp
+29
-0
No files found.
src/ngraph/frontend/onnx_import/CMakeLists.txt
View file @
d33698fa
...
...
@@ -37,12 +37,14 @@ add_library(onnx_import STATIC
core/operator_set.hpp
core/tensor.hpp
core/value_info.hpp
default_opset.hpp
exceptions.cpp
exceptions.hpp
op/acos.hpp
op/acosh.cpp
op/acosh.hpp
op/add.hpp
op/add.cpp
op/and.hpp
op/argmax.cpp
op/argmax.hpp
...
...
src/ngraph/frontend/onnx_import/default_opset.hpp
0 → 100644
View file @
d33698fa
#include "ngraph/opsets/opset1.hpp"
namespace
ngraph
{
namespace
onnx_import
{
namespace
default_opset
=
ngraph
::
opset1
;
}
}
src/ngraph/frontend/onnx_import/op/abs.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/abs.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
abs
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Abs
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Abs
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/acos.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/acos.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
acos
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Acos
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Acos
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/acosh.cpp
View file @
d33698fa
...
...
@@ -17,11 +17,9 @@
#include <memory>
#include "acosh.hpp"
#include "default_opset.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/log.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/sqrt.hpp"
#include "ngraph/op/subtract.hpp"
#include "ngraph/shape.hpp"
...
...
@@ -42,15 +40,15 @@ namespace ngraph
// arccosh(x) = ln(x + sqrt(x^2 - 1))
//
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
{
ngraph
::
op
::
Constant
::
create
(
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
{
default_opset
::
Constant
::
create
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
(
ngraph
::
shape_size
(
data
->
get_shape
()),
1.
f
))};
std
::
shared_ptr
<
ngraph
::
Node
>
sqrt_node
{
std
::
make_shared
<
ngraph
::
op
::
Sqrt
>
(
data
*
data
-
one_node
)};
std
::
make_shared
<
default_opset
::
Sqrt
>
(
data
*
data
-
one_node
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
data
+
sqrt_node
)};
return
{
std
::
make_shared
<
default_opset
::
Log
>
(
data
+
sqrt_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/add.cpp
0 → 100644
View file @
d33698fa
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include "add.hpp"
#include "default_opset.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
namespace
onnx_import
{
namespace
op
{
namespace
set_1
{
NodeVector
add
(
const
Node
&
node
)
{
auto
left_rank
=
node
.
get_ng_inputs
().
at
(
0
)
->
get_shape
().
size
();
auto
right_rank
=
node
.
get_ng_inputs
().
at
(
1
)
->
get_shape
().
size
();
auto
axis
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"axis"
,
left_rank
-
right_rank
);
NodeVector
ng_inputs
{
ngraph
::
op
::
legacy_style_broadcast_for_binary_operation
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
),
axis
)};
return
{
std
::
make_shared
<
ngraph
::
opset0
::
Add
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
}
}
// namespace set_1
namespace
set_7
{
NodeVector
add
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
default_opset
::
Add
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
}
// namespace set_7
}
// namespace op
}
// namespace onnx_import
}
// namespace ngraph
src/ngraph/frontend/onnx_import/op/add.hpp
View file @
d33698fa
...
...
@@ -20,8 +20,6 @@
#include "core/node.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/util/broadcasting.hpp"
namespace
ngraph
{
...
...
@@ -31,27 +29,13 @@ namespace ngraph
{
namespace
set_1
{
inline
NodeVector
add
(
const
Node
&
node
)
{
auto
left_rank
=
node
.
get_ng_inputs
().
at
(
0
)
->
get_shape
().
size
();
auto
right_rank
=
node
.
get_ng_inputs
().
at
(
1
)
->
get_shape
().
size
();
auto
axis
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"axis"
,
left_rank
-
right_rank
);
NodeVector
ng_inputs
{
ngraph
::
op
::
legacy_style_broadcast_for_binary_operation
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
),
axis
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Add
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
}
NodeVector
add
(
const
Node
&
node
);
}
// namespace set_1
namespace
set_7
{
inline
NodeVector
add
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Add
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
NodeVector
add
(
const
Node
&
node
);
}
// namespace set_7
...
...
src/ngraph/frontend/onnx_import/op/and.hpp
View file @
d33698fa
...
...
@@ -19,6 +19,7 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/and.hpp"
...
...
@@ -32,7 +33,7 @@ namespace ngraph
{
inline
NodeVector
logical_and
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
LogicalAnd
>
(
return
{
std
::
make_shared
<
default_opset
::
LogicalAnd
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/argmax.cpp
View file @
d33698fa
...
...
@@ -17,7 +17,7 @@
#include "argmax.hpp"
#include "core/node.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op
/argmax
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "utils/reduction.hpp"
namespace
ngraph
...
...
@@ -30,7 +30,7 @@ namespace ngraph
{
NodeVector
argmax
(
const
Node
&
node
)
{
return
{
reduction
::
make_ng_index_reduction_op
<
ngraph
::
op
::
ArgMax
>
(
node
)};
return
{
reduction
::
make_ng_index_reduction_op
<
ngraph
::
op
set0
::
ArgMax
>
(
node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/argmin.cpp
View file @
d33698fa
...
...
@@ -17,7 +17,7 @@
#include "argmin.hpp"
#include "core/node.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op
/argmin
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "utils/reduction.hpp"
namespace
ngraph
...
...
@@ -30,7 +30,7 @@ namespace ngraph
{
NodeVector
argmin
(
const
Node
&
node
)
{
return
{
reduction
::
make_ng_index_reduction_op
<
ngraph
::
op
::
ArgMin
>
(
node
)};
return
{
reduction
::
make_ng_index_reduction_op
<
ngraph
::
op
set0
::
ArgMin
>
(
node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/asin.hpp
View file @
d33698fa
...
...
@@ -19,6 +19,7 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/asin.hpp"
...
...
@@ -32,7 +33,7 @@ namespace ngraph
{
inline
NodeVector
asin
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Asin
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Asin
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/asinh.cpp
View file @
d33698fa
...
...
@@ -17,11 +17,9 @@
#include <memory>
#include "asinh.hpp"
#include "default_opset.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/log.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/sqrt.hpp"
#include "ngraph/shape.hpp"
namespace
ngraph
...
...
@@ -41,15 +39,15 @@ namespace ngraph
// asinh(x) = ln(x + sqrt(x^2 + 1))
//
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
{
ngraph
::
op
::
Constant
::
create
(
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
{
default_opset
::
Constant
::
create
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
(
ngraph
::
shape_size
(
data
->
get_shape
()),
1.
f
))};
std
::
shared_ptr
<
ngraph
::
Node
>
sqrt_node
{
std
::
make_shared
<
ngraph
::
op
::
Sqrt
>
(
data
*
data
+
one_node
)};
std
::
make_shared
<
default_opset
::
Sqrt
>
(
data
*
data
+
one_node
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
data
+
sqrt_node
)};
return
{
std
::
make_shared
<
default_opset
::
Log
>
(
data
+
sqrt_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/atan.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/atan.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
atan
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Atan
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Atan
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/atanh.cpp
View file @
d33698fa
...
...
@@ -17,9 +17,8 @@
#include <memory>
#include "atanh.hpp"
#include "default_opset.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/log.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/subtract.hpp"
#include "ngraph/shape.hpp"
...
...
@@ -42,18 +41,18 @@ namespace ngraph
// = 0.5 * (ln(1 + x) - ln(1 - x))
//
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
{
ngraph
::
op
::
Constant
::
create
(
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
{
default_opset
::
Constant
::
create
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
(
ngraph
::
shape_size
(
data
->
get_shape
()),
1.
f
))};
std
::
shared_ptr
<
ngraph
::
Node
>
half_node
{
ngraph
::
op
::
Constant
::
create
(
std
::
shared_ptr
<
ngraph
::
Node
>
half_node
{
default_opset
::
Constant
::
create
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
(
ngraph
::
shape_size
(
data
->
get_shape
()),
0.5
f
))};
return
{
half_node
*
(
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
one_node
+
data
)
-
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
one_node
-
data
))};
return
{
half_node
*
(
std
::
make_shared
<
default_opset
::
Log
>
(
one_node
+
data
)
-
std
::
make_shared
<
default_opset
::
Log
>
(
one_node
-
data
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/batch_norm.cpp
View file @
d33698fa
...
...
@@ -19,8 +19,9 @@
#include "batch_norm.hpp"
#include "core/null_node.hpp"
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/op
/batch_norm
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
namespace
ngraph
{
...
...
@@ -56,7 +57,7 @@ namespace ngraph
{
mean
=
inputs
.
at
(
3
);
var
=
inputs
.
at
(
4
);
return
{
std
::
make_shared
<
ngraph
::
op
::
BatchNormInference
>
(
return
{
std
::
make_shared
<
default_opset
::
BatchNormInference
>
(
x
,
scale
,
bias
,
mean
,
var
,
epsilon
),
after_bn_mean
,
after_bn_var
,
...
...
@@ -64,8 +65,8 @@ namespace ngraph
saved_var
};
}
return
{
std
::
make_shared
<
ngraph
::
op
::
BatchNormTraining
>
(
x
,
scale
,
bias
,
epsilon
),
return
{
std
::
make_shared
<
ngraph
::
opset0
::
BatchNormTraining
>
(
x
,
scale
,
bias
,
epsilon
),
after_bn_mean
,
after_bn_var
,
saved_mean
,
...
...
src/ngraph/frontend/onnx_import/op/cast.cpp
View file @
d33698fa
...
...
@@ -16,7 +16,7 @@
#include <memory>
#include "cast.hpp"
#include "
ngraph/op/conver
t.hpp"
#include "
default_opse
t.hpp"
#include "ngraph/type/element_type.hpp"
#include "utils/common.hpp"
...
...
@@ -34,7 +34,7 @@ namespace ngraph
int64_t
target_type
=
node
.
get_attribute_value
<
int64_t
>
(
"to"
);
element
::
Type
elem_type
=
common
::
get_ngraph_element_type
(
target_type
);
return
{
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
data
,
elem_type
)};
return
{
std
::
make_shared
<
default_opset
::
Convert
>
(
data
,
elem_type
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/ceil.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/ceiling.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
ceil
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Ceiling
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Ceiling
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/clip.cpp
View file @
d33698fa
...
...
@@ -18,12 +18,9 @@
#include <memory>
#include "clip.hpp"
#include "default_opset.hpp"
#include "ngraph/builder/make_constant.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/clamp.hpp"
#include "ngraph/op/maximum.hpp"
#include "ngraph/op/minimum.hpp"
#include "ngraph/op/reshape.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -43,7 +40,7 @@ namespace ngraph
const
double
min_value
=
node
.
get_attribute_value
<
double
>
(
"min"
,
std
::
numeric_limits
<
double
>::
lowest
());
return
{
std
::
make_shared
<
ngraph
::
op
::
Clamp
>
(
data
,
min_value
,
max_value
)};
return
{
std
::
make_shared
<
default_opset
::
Clamp
>
(
data
,
min_value
,
max_value
)};
}
}
// namespace set_1
...
...
@@ -83,12 +80,12 @@ namespace ngraph
data_type
,
data_shape
,
std
::
numeric_limits
<
double
>::
max
());
}
auto
max_of_min_and_data
=
std
::
make_shared
<
ngraph
::
op
::
Maximum
>
(
auto
max_of_min_and_data
=
std
::
make_shared
<
ngraph
::
op
set0
::
Maximum
>
(
min
,
data
,
ngraph
::
op
::
AutoBroadcastSpec
(
ngraph
::
op
::
AutoBroadcastType
::
NUMPY
));
return
{
std
::
make_shared
<
ngraph
::
op
::
Minimum
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Minimum
>
(
max
,
max_of_min_and_data
,
ngraph
::
op
::
AutoBroadcastSpec
(
ngraph
::
op
::
AutoBroadcastType
::
NUMPY
))};
...
...
src/ngraph/frontend/onnx_import/op/concat.cpp
View file @
d33698fa
...
...
@@ -17,6 +17,7 @@
#include <cstdint>
#include "concat.hpp"
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/op/concat.hpp"
#include "utils/common.hpp"
...
...
@@ -36,7 +37,7 @@ namespace ngraph
size_t
valid_axis
=
common
::
validate_axis
(
node
,
axis
,
inputs
.
at
(
0
)
->
get_shape
().
size
());
return
{
std
::
make_shared
<
ngraph
::
op
::
Concat
>
(
inputs
,
valid_axis
)};
return
{
std
::
make_shared
<
default_opset
::
Concat
>
(
inputs
,
valid_axis
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/constant.cpp
View file @
d33698fa
...
...
@@ -16,6 +16,7 @@
#include "constant.hpp"
#include "core/tensor.hpp"
#include "default_opset.hpp"
#include "ngraph/op/constant.hpp"
namespace
ngraph
...
...
@@ -29,98 +30,99 @@ namespace ngraph
namespace
{
template
<
typename
T
>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
__make_ng_constant
(
const
element
::
Type
&
type
,
const
Tensor
&
tensor
)
{
return
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
return
std
::
make_shared
<
default_opset
::
Constant
>
(
type
,
tensor
.
get_shape
(),
tensor
.
get_data
<
T
>
());
}
template
<
Tensor
::
Type
>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
(
const
Tensor
&
tensor
)
{
throw
error
::
tensor
::
unsupported_data_type
{
tensor
};
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
float16
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
ngraph
::
float16
>
(
element
::
f16
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
float32
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
float
>
(
element
::
f32
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
float64
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
double
>
(
element
::
f64
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
int8
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
int8_t
>
(
element
::
i8
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
int16
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
int16_t
>
(
element
::
i16
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
int32
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
int32_t
>
(
element
::
i32
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
int64
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
int64_t
>
(
element
::
i64
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
uint8
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
uint8_t
>
(
element
::
u8
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
uint16
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
uint16_t
>
(
element
::
u16
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
uint32
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
uint32_t
>
(
element
::
u32
,
tensor
);
}
template
<>
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_ng_constant
<
Tensor
::
Type
::
uint64
>
(
const
Tensor
&
tensor
)
{
return
__make_ng_constant
<
uint64_t
>
(
element
::
u64
,
tensor
);
}
inline
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
make_constant
(
const
Tensor
&
tensor
)
inline
std
::
shared_ptr
<
default_opset
::
Constant
>
make_constant
(
const
Tensor
&
tensor
)
{
#define MAKE_NG_CONSTANT(data_type_) \
case data_type_: return make_ng_constant<data_type_>(tensor)
...
...
src/ngraph/frontend/onnx_import/op/conv.cpp
View file @
d33698fa
...
...
@@ -19,17 +19,14 @@
#include <vector>
#include "conv.hpp"
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/concat.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/convolution.hpp"
#include "ngraph/op/fused/group_conv.hpp"
#include "ngraph/op/slice.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/convpool.hpp"
namespace
ngraph
...
...
@@ -61,7 +58,7 @@ namespace ngraph
auto
reshaped_filters
=
ngraph
::
builder
::
reshape
(
filters
,
filters_shape
);
return
std
::
make_shared
<
ngraph
::
op
::
v1
::
GroupConvolution
>
(
return
std
::
make_shared
<
default_opset
::
GroupConvolution
>
(
data
,
reshaped_filters
,
strides
,
...
...
@@ -72,7 +69,7 @@ namespace ngraph
}
else
{
return
std
::
make_shared
<
ngraph
::
op
::
v1
::
Convolution
>
(
data
,
return
std
::
make_shared
<
default_opset
::
Convolution
>
(
data
,
filters
,
strides
,
padding_below
,
...
...
@@ -134,11 +131,11 @@ namespace ngraph
auto
bias
=
inputs
.
at
(
2
);
const
Shape
&
new_shape
=
conv_node
->
get_shape
();
auto
broadcasted_bias
=
std
::
make_shared
<
ngraph
::
op
::
Broadcast
>
(
auto
broadcasted_bias
=
std
::
make_shared
<
ngraph
::
op
set0
::
Broadcast
>
(
bias
,
new_shape
,
ngraph
::
op
::
calculate_broadcast_axes
(
new_shape
,
bias
->
get_shape
(),
1
));
return
{
std
::
make_shared
<
ngraph
::
op
::
Add
>
(
conv_node
,
broadcasted_bias
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Add
>
(
conv_node
,
broadcasted_bias
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/conv_integer.cpp
View file @
d33698fa
...
...
@@ -15,11 +15,11 @@
//*****************************************************************************
#include "conv_integer.hpp"
#include "exceptions.hpp"
#include "ngraph/builder/make_constant.hpp"
#include "ngraph/frontend/onnx_import/exceptions.hpp"
#include "ngraph/frontend/onnx_import/utils/convpool.hpp"
#include "ngraph/op/quantized_convolution.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/convpool.hpp"
using
namespace
ngraph
::
builder
;
...
...
@@ -66,7 +66,7 @@ namespace ngraph
if
(
num_inputs
==
2
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
QuantizedConvolution
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
QuantizedConvolution
>
(
input
,
filters
,
window_movement_strides
,
...
...
@@ -92,7 +92,7 @@ namespace ngraph
filters_zero_point
=
inputs
.
at
(
3
);
}
return
{
std
::
make_shared
<
ngraph
::
op
::
QuantizedConvolution
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
QuantizedConvolution
>
(
input
,
filters
,
window_movement_strides
,
...
...
src/ngraph/frontend/onnx_import/op/conv_transpose.cpp
View file @
d33698fa
...
...
@@ -27,6 +27,7 @@
#include "ngraph/op/fused/group_conv_transpose.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/shape.hpp"
#include "utils/convpool.hpp"
...
...
@@ -84,7 +85,7 @@ namespace ngraph
std
::
shared_ptr
<
ngraph
::
Node
>
conv_node
;
if
(
!
output_shape
.
empty
())
{
conv_node
=
std
::
make_shared
<
ngraph
::
op
::
GroupConvolutionTranspose
>
(
conv_node
=
std
::
make_shared
<
ngraph
::
op
set0
::
GroupConvolutionTranspose
>
(
data
,
filters
,
strides
,
...
...
@@ -95,7 +96,7 @@ namespace ngraph
}
else
{
conv_node
=
std
::
make_shared
<
ngraph
::
op
::
GroupConvolutionTranspose
>
(
conv_node
=
std
::
make_shared
<
ngraph
::
op
set0
::
GroupConvolutionTranspose
>
(
data
,
filters
,
strides
,
...
...
@@ -115,7 +116,7 @@ namespace ngraph
auto
bias
=
inputs
.
at
(
2
);
return
{
std
::
make_shared
<
ngraph
::
op
::
Add
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Add
>
(
conv_node
,
ngraph
::
op
::
make_broadcast_node
(
bias
,
conv_node
->
get_shape
(),
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/cum_sum.cpp
View file @
d33698fa
...
...
@@ -17,8 +17,8 @@
#include <memory>
#include "cum_sum.hpp"
#include "
ngraph/op/constan
t.hpp"
#include "ngraph/op
/cum_sum
.hpp"
#include "
default_opse
t.hpp"
#include "ngraph/op
sets/opset0
.hpp"
namespace
ngraph
{
...
...
@@ -42,10 +42,11 @@ namespace ngraph
}
else
{
axis
=
ngraph
::
op
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
0
});
// default
axis
=
default_opset
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
0
});
// default
}
return
NodeVector
{
std
::
make_shared
<
ngraph
::
op
::
CumSum
>
(
data
,
axis
,
exclusive
,
reverse
)};
std
::
make_shared
<
ngraph
::
op
set0
::
CumSum
>
(
data
,
axis
,
exclusive
,
reverse
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/depth_to_space.cpp
View file @
d33698fa
...
...
@@ -15,7 +15,7 @@
//*****************************************************************************
#include "depth_to_space.hpp"
#include "
ngraph/op/fused/depth_to_space
.hpp"
#include "
default_opset
.hpp"
namespace
ngraph
{
...
...
@@ -30,11 +30,12 @@ namespace ngraph
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
const
auto
mode
=
node
.
get_attribute_value
<
std
::
string
>
(
"mode"
,
"DCR"
);
const
auto
ngraph_mode
=
(
mode
==
"DCR"
)
?
ngraph
::
op
::
DepthToSpace
::
DepthToSpaceMode
::
BLOCKS_FIRST
:
ngraph
::
op
::
DepthToSpace
::
DepthToSpaceMode
::
DEPTH_FIRST
;
(
mode
==
"DCR"
)
?
default_opset
::
DepthToSpace
::
DepthToSpaceMode
::
BLOCKS_FIRST
:
default_opset
::
DepthToSpace
::
DepthToSpaceMode
::
DEPTH_FIRST
;
const
auto
block_size
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"blocksize"
);
return
NodeVector
{
std
::
make_shared
<
ngraph
::
op
::
DepthToSpace
>
(
data
,
ngraph_mode
,
block_size
)};
return
NodeVector
{
std
::
make_shared
<
default_opset
::
DepthToSpace
>
(
data
,
ngraph_mode
,
block_size
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/dequantize_linear.cpp
View file @
d33698fa
...
...
@@ -17,11 +17,13 @@
#include <cstdint>
#include <memory>
#include "default_opset.hpp"
#include "dequantize_linear.hpp"
#include "ngraph/axis_set.hpp"
#include "ngraph/builder/make_constant.hpp"
#include "ngraph/op/convert.hpp"
#include "ngraph/op/dequantize.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/shape.hpp"
namespace
ngraph
...
...
@@ -73,11 +75,11 @@ namespace ngraph
if
(
x
->
get_element_type
()
!=
zero_point
->
get_element_type
())
{
zero_point
=
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
zero_point
,
x
->
get_element_type
());
zero_point
=
std
::
make_shared
<
default_opset
::
Convert
>
(
zero_point
,
x
->
get_element_type
());
}
return
{
std
::
make_shared
<
ngraph
::
op
::
Dequantize
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Dequantize
>
(
x
,
x_scale
,
zero_point
,
x_scale
->
get_element_type
(),
axes
)};
}
...
...
src/ngraph/frontend/onnx_import/op/div.hpp
View file @
d33698fa
...
...
@@ -19,9 +19,10 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -40,7 +41,8 @@ namespace ngraph
NodeVector
ng_inputs
{
ngraph
::
op
::
legacy_style_broadcast_for_binary_operation
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
),
axis
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Divide
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
return
{
std
::
make_shared
<
ngraph
::
opset0
::
Divide
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
}
}
// namespace set_1
...
...
@@ -49,7 +51,7 @@ namespace ngraph
{
inline
NodeVector
div
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Divide
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Divide
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/elu.cpp
View file @
d33698fa
...
...
@@ -17,9 +17,8 @@
#include <memory>
#include <vector>
#include "default_opset.hpp"
#include "elu.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/elu.hpp"
namespace
ngraph
{
...
...
@@ -34,7 +33,7 @@ namespace ngraph
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
double
alpha
=
node
.
get_attribute_value
<
double
>
(
"alpha"
,
1
);
return
NodeVector
{
std
::
make_shared
<
ngraph
::
op
::
Elu
>
(
data
,
alpha
)};
return
NodeVector
{
std
::
make_shared
<
default_opset
::
Elu
>
(
data
,
alpha
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/equal.hpp
View file @
d33698fa
...
...
@@ -19,9 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/equal.hpp"
#include "ngraph/op/util/broadcasting.hpp"
namespace
ngraph
{
...
...
@@ -33,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
equal
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Equal
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Equal
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/erf.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/erf.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
erf
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Erf
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Erf
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/exp.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/exp.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
exp
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Exp
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Exp
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/expand.cpp
View file @
d33698fa
...
...
@@ -18,10 +18,10 @@
#include <cstdint>
#include <memory>
#include "default_opset.hpp"
#include "expand.hpp"
#include "ngraph/descriptor/output.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/experimental/dyn_broadcast.hpp"
#include "ngraph/op/experimental/dyn_reshape.hpp"
#include "ngraph/op/experimental/range.hpp"
...
...
@@ -46,7 +46,8 @@ namespace ngraph
"Ngraph does not support dynamic braodcasting for Expand op."
);
std
::
vector
<
std
::
size_t
>
shape_vector
=
ngraph
::
as_type_ptr
<
ngraph
::
op
::
Constant
>
(
shape
)
->
get_vector
<
std
::
size_t
>
();
ngraph
::
as_type_ptr
<
default_opset
::
Constant
>
(
shape
)
->
get_vector
<
std
::
size_t
>
();
const
ngraph
::
Shape
shape_shape
{
shape_vector
};
return
{
ngraph
::
op
::
numpy_style_broadcast
(
data
,
shape_shape
)};
...
...
src/ngraph/frontend/onnx_import/op/floor.hpp
View file @
d33698fa
...
...
@@ -19,6 +19,7 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/floor.hpp"
...
...
@@ -32,7 +33,7 @@ namespace ngraph
{
inline
NodeVector
floor
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Floor
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Floor
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/gather.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/opsets/opset1.hpp"
#include "utils/common.hpp"
namespace
ngraph
...
...
@@ -39,10 +39,10 @@ namespace ngraph
auto
axis
=
node
.
get_attribute_value
<
int64_t
>
(
"axis"
,
0
);
auto
valid_axis
=
common
::
validate_axis
(
node
,
axis
,
data
->
get_shape
().
size
());
return
{
std
::
make_shared
<
opset1
::
Gather
>
(
return
{
std
::
make_shared
<
default_opset
::
Gather
>
(
data
,
indices
,
opset1
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
valid_axis
}))};
default_opset
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
valid_axis
}))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/gather_nd.cpp
View file @
d33698fa
...
...
@@ -14,7 +14,7 @@
// limitations under the License.
//*****************************************************************************
#include "ngraph/op
/gather_nd
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "utils/common.hpp"
namespace
ngraph
...
...
@@ -31,7 +31,7 @@ namespace ngraph
auto
data
=
ng_inputs
.
at
(
0
);
auto
indices
=
ng_inputs
.
at
(
1
);
return
{
std
::
make_shared
<
ngraph
::
op
::
GatherND
>
(
data
,
indices
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
GatherND
>
(
data
,
indices
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/gemm.cpp
View file @
d33698fa
...
...
@@ -16,6 +16,7 @@
#include <memory>
#include "default_opset.hpp"
#include "gemm.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/op/add.hpp"
...
...
@@ -44,16 +45,16 @@ namespace ngraph
}
else
{
input_c
=
ngraph
::
op
::
Constant
::
create
(
input_c
=
default_opset
::
Constant
::
create
(
input_b
->
get_element_type
(),
ngraph
::
Shape
{},
{
0
});
}
const
auto
alpha
=
node
.
get_attribute_value
<
float
>
(
"alpha"
,
1
);
const
auto
beta
=
node
.
get_attribute_value
<
float
>
(
"beta"
,
1
);
const
auto
alpha_node
=
ngraph
::
op
::
Constant
::
create
(
const
auto
alpha_node
=
default_opset
::
Constant
::
create
(
element
::
Type_t
::
f32
,
Shape
{},
std
::
vector
<
float
>
{
alpha
});
const
auto
beta_node
=
ngraph
::
op
::
Constant
::
create
(
const
auto
beta_node
=
default_opset
::
Constant
::
create
(
element
::
Type_t
::
f32
,
Shape
{},
std
::
vector
<
float
>
{
beta
});
const
bool
trans_a
=
node
.
get_attribute_value
<
int64_t
>
(
"transA"
,
0
);
...
...
@@ -75,11 +76,11 @@ namespace ngraph
auto
matmul_node
=
std
::
make_shared
<
ngraph
::
op
::
MatMul
>
(
input_a
,
input_b
);
auto
alpha_times_product
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
alpha_node
,
matmul_node
);
std
::
make_shared
<
default_opset
::
Multiply
>
(
alpha_node
,
matmul_node
);
auto
beta_times_input_c
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
beta_node
,
input_c
);
std
::
make_shared
<
default_opset
::
Multiply
>
(
beta_node
,
input_c
);
return
NodeVector
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Add
>
(
alpha_times_product
,
return
NodeVector
{
std
::
make_shared
<
default_opset
::
Add
>
(
alpha_times_product
,
beta_times_input_c
)};
}
...
...
@@ -100,30 +101,30 @@ namespace ngraph
}
else
{
input_c
=
ngraph
::
op
::
Constant
::
create
(
input_c
=
default_opset
::
Constant
::
create
(
input_b
->
get_element_type
(),
ngraph
::
Shape
{},
{
0
});
}
const
auto
alpha
=
node
.
get_attribute_value
<
float
>
(
"alpha"
,
1
);
const
auto
beta
=
node
.
get_attribute_value
<
float
>
(
"beta"
,
1
);
const
auto
alpha_node
=
ngraph
::
op
::
Constant
::
create
(
const
auto
alpha_node
=
default_opset
::
Constant
::
create
(
element
::
Type_t
::
f32
,
Shape
{},
std
::
vector
<
float
>
{
alpha
});
const
auto
beta_node
=
ngraph
::
op
::
Constant
::
create
(
const
auto
beta_node
=
default_opset
::
Constant
::
create
(
element
::
Type_t
::
f32
,
Shape
{},
std
::
vector
<
float
>
{
beta
});
const
bool
trans_a
=
node
.
get_attribute_value
<
int64_t
>
(
"transA"
,
0
);
const
bool
trans_b
=
node
.
get_attribute_value
<
int64_t
>
(
"transB"
,
0
);
auto
matmul_node
=
std
::
make_shared
<
ngraph
::
op
::
MatMul
>
(
input_a
,
input_b
,
trans_a
,
trans_b
);
std
::
make_shared
<
default_opset
::
MatMul
>
(
input_a
,
input_b
,
trans_a
,
trans_b
);
auto
alpha_times_product
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
alpha_node
,
matmul_node
);
std
::
make_shared
<
default_opset
::
Multiply
>
(
alpha_node
,
matmul_node
);
auto
beta_times_input_c
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
beta_node
,
input_c
);
std
::
make_shared
<
default_opset
::
Multiply
>
(
beta_node
,
input_c
);
return
NodeVector
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Add
>
(
alpha_times_product
,
return
NodeVector
{
std
::
make_shared
<
default_opset
::
Add
>
(
alpha_times_product
,
beta_times_input_c
)};
}
...
...
src/ngraph/frontend/onnx_import/op/greater.hpp
View file @
d33698fa
...
...
@@ -19,6 +19,7 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/greater.hpp"
#include "ngraph/op/util/broadcasting.hpp"
...
...
@@ -33,7 +34,7 @@ namespace ngraph
{
inline
NodeVector
greater
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Greater
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Greater
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/hard_sigmoid.cpp
View file @
d33698fa
...
...
@@ -16,11 +16,8 @@
#include <memory>
#include "default_opset.hpp"
#include "hard_sigmoid.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/hard_sigmoid.hpp"
using
namespace
ngraph
::
op
;
namespace
ngraph
{
...
...
@@ -34,17 +31,17 @@ namespace ngraph
{
const
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
const
auto
alpha
=
Constant
::
create
<
double
>
(
const
auto
alpha
=
default_opset
::
Constant
::
create
<
double
>
(
data
->
get_element_type
(),
Shape
{},
std
::
vector
<
double
>
{
node
.
get_attribute_value
<
double
>
(
"alpha"
,
0.2
)});
const
auto
beta
=
Constant
::
create
<
double
>
(
const
auto
beta
=
default_opset
::
Constant
::
create
<
double
>
(
data
->
get_element_type
(),
Shape
{},
std
::
vector
<
double
>
{
node
.
get_attribute_value
<
double
>
(
"beta"
,
0.5
)});
return
{
std
::
make_shared
<
ngraph
::
op
::
HardSigmoid
>
(
data
,
alpha
,
beta
)};
return
{
std
::
make_shared
<
default_opset
::
HardSigmoid
>
(
data
,
alpha
,
beta
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/hardmax.cpp
View file @
d33698fa
...
...
@@ -18,8 +18,7 @@
#include "exceptions.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/frontend/onnx_import/utils/common.hpp"
#include "ngraph/op/argmax.hpp"
#include "ngraph/op/embedding_lookup.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -42,7 +41,7 @@ namespace ngraph
const
auto
&
coerced_shape
=
coerced_tensor
->
get_shape
();
const
std
::
shared_ptr
<
ngraph
::
Node
>
argmax_2d
=
std
::
make_shared
<
ngraph
::
op
::
ArgMax
>
(
coerced_tensor
,
1
,
element
::
i64
);
std
::
make_shared
<
ngraph
::
op
set0
::
ArgMax
>
(
coerced_tensor
,
1
,
element
::
i64
);
std
::
shared_ptr
<
ngraph
::
Node
>
eye_matrix
=
common
::
square_identity
(
coerced_shape
.
at
(
1
),
input
->
get_element_type
());
...
...
@@ -50,7 +49,7 @@ namespace ngraph
// the results are elements of the eye_matrix indexed by argmax_2d values
// in other words: eye_matrix[argmax_2d]
auto
results
=
std
::
make_shared
<
ngraph
::
op
::
EmbeddingLookup
>
(
argmax_2d
,
eye_matrix
);
std
::
make_shared
<
ngraph
::
op
set0
::
EmbeddingLookup
>
(
argmax_2d
,
eye_matrix
);
return
{
ngraph
::
builder
::
reshape
(
results
,
input_shape
)};
}
...
...
src/ngraph/frontend/onnx_import/op/instance_norm.cpp
View file @
d33698fa
...
...
@@ -17,18 +17,18 @@
#include <cstddef>
#include <memory>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "instance_norm.hpp"
#include "ngraph/axis_set.hpp"
#include "ngraph/builder/reduce_ops.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/sqrt.hpp"
#include "ngraph/op/subtract.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/common.hpp"
namespace
ngraph
...
...
@@ -63,7 +63,7 @@ namespace ngraph
common
::
get_monotonic_range
<
std
::
size_t
>
(
data
->
get_shape
().
size
(),
2
)};
const
std
::
shared_ptr
<
ngraph
::
Node
>
eps_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
data
->
get_element_type
(),
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
{
epsilon
});
...
...
@@ -73,14 +73,14 @@ namespace ngraph
.
at
(
1
);
std
::
shared_ptr
<
ngraph
::
Node
>
mean
=
builder
::
mean
(
data
,
reduction_axes
);
mean
=
std
::
make_shared
<
ngraph
::
op
::
Broadcast
>
(
mean
=
std
::
make_shared
<
ngraph
::
op
set0
::
Broadcast
>
(
mean
,
data
->
get_shape
(),
reduction_axes
);
std
::
shared_ptr
<
ngraph
::
Node
>
variance
=
builder
::
variance
(
data
,
reduction_axes
);
variance
=
std
::
make_shared
<
ngraph
::
op
::
Broadcast
>
(
variance
=
std
::
make_shared
<
ngraph
::
op
set0
::
Broadcast
>
(
variance
,
data
->
get_shape
(),
reduction_axes
);
const
auto
sqrt
=
std
::
make_shared
<
ngraph
::
op
::
Sqrt
>
(
variance
+
eps_node
);
const
auto
sqrt
=
std
::
make_shared
<
default_opset
::
Sqrt
>
(
variance
+
eps_node
);
return
{
scale
*
(
data
-
mean
)
/
sqrt
+
bias
};
}
...
...
src/ngraph/frontend/onnx_import/op/leaky_relu.cpp
View file @
d33698fa
...
...
@@ -16,11 +16,12 @@
#include <memory>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "leaky_relu.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/maximum.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -39,10 +40,10 @@ namespace ngraph
<<
" alpha value should be in range (0,1)"
;
std
::
shared_ptr
<
ngraph
::
Node
>
alpha_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
data
->
get_element_type
(),
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
double
>
{
alpha
});
return
{
std
::
make_shared
<
ngraph
::
op
::
Maximum
>
(
data
*
alpha_node
,
data
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Maximum
>
(
data
*
alpha_node
,
data
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/less.hpp
View file @
d33698fa
...
...
@@ -19,6 +19,7 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/less.hpp"
#include "ngraph/op/util/broadcasting.hpp"
...
...
@@ -33,7 +34,7 @@ namespace ngraph
{
inline
NodeVector
less
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Less
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Less
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/log_softmax.cpp
View file @
d33698fa
...
...
@@ -17,7 +17,7 @@
#include <memory>
#include "log_softmax.hpp"
#include "ngraph/op
/fused/log_softmax
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
namespace
ngraph
{
...
...
@@ -34,7 +34,7 @@ namespace ngraph
auto
data_shape
=
data
->
get_shape
();
int
axis
=
node
.
get_attribute_value
<
int64_t
>
(
"axis"
,
1
);
return
{
std
::
make_shared
<
ngraph
::
op
::
LogSoftmax
>
(
data
,
axis
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
LogSoftmax
>
(
data
,
axis
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/lp_norm.cpp
View file @
d33698fa
...
...
@@ -22,8 +22,8 @@
#include "lp_norm.hpp"
#include "ngraph/axis_set.hpp"
#include "ngraph/builder/norm.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/common.hpp"
namespace
ngraph
...
...
@@ -49,7 +49,7 @@ namespace ngraph
const
AxisSet
reduction_axes
{
valid_axis
};
std
::
shared_ptr
<
ngraph
::
Node
>
norm
=
ngraph
::
builder
::
lp_norm
(
data
,
reduction_axes
,
static_cast
<
std
::
size_t
>
(
p_norm
));
norm
=
std
::
make_shared
<
ngraph
::
op
::
Broadcast
>
(
norm
=
std
::
make_shared
<
ngraph
::
op
set0
::
Broadcast
>
(
norm
,
data
->
get_shape
(),
reduction_axes
);
return
{
data
/
norm
};
...
...
src/ngraph/frontend/onnx_import/op/lp_pool.cpp
View file @
d33698fa
...
...
@@ -18,6 +18,7 @@
#include <cstdint>
#include <memory>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "lp_pool.hpp"
#include "ngraph/axis_set.hpp"
...
...
@@ -25,6 +26,7 @@
#include "ngraph/builder/split.hpp"
#include "ngraph/op/concat.hpp"
#include "ngraph/op/reshape.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/util.hpp"
#include "utils/common.hpp"
...
...
@@ -61,13 +63,13 @@ namespace ngraph
// output shape is all ones except N channel
Shape
output_shape
(
orig_shape
.
size
(),
1
);
output_shape
.
at
(
0
)
=
orig_shape
.
at
(
0
);
slice
=
std
::
make_shared
<
ngraph
::
op
::
Reshape
>
(
slice
=
std
::
make_shared
<
ngraph
::
op
set0
::
Reshape
>
(
slice
,
ngraph
::
get_default_order
(
slice
->
get_shape
().
size
()),
output_shape
);
}
return
{
std
::
make_shared
<
ngraph
::
op
::
Concat
>
(
slices
,
channel_axis
)};
return
{
std
::
make_shared
<
default_opset
::
Concat
>
(
slices
,
channel_axis
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/lrn.cpp
View file @
d33698fa
...
...
@@ -16,8 +16,8 @@
#include <memory>
#include "default_opset.hpp"
#include "lrn.hpp"
#include "ngraph/op/lrn.hpp"
namespace
ngraph
{
...
...
@@ -35,7 +35,7 @@ namespace ngraph
double
bias
=
node
.
get_attribute_value
<
double
>
(
"bias"
,
1
);
size_t
size
=
node
.
get_attribute_value
<
size_t
>
(
"size"
);
return
{
std
::
make_shared
<
ngraph
::
op
::
LRN
>
(
data
,
alpha
,
beta
,
bias
,
size
)};
return
{
std
::
make_shared
<
default_opset
::
LRN
>
(
data
,
alpha
,
beta
,
bias
,
size
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/lstm.cpp
View file @
d33698fa
...
...
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "lstm.hpp"
#include "ngraph/builder/split.hpp"
...
...
@@ -29,6 +30,7 @@
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/lstm_sequence.hpp"
#include "ngraph/op/get_output_element.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type.hpp"
...
...
@@ -94,7 +96,7 @@ namespace ngraph
}
else
{
m_map
[
LSTMInput
::
LSTM_INPUT_B
]
=
ngraph
::
op
::
Constant
::
create
(
m_map
[
LSTMInput
::
LSTM_INPUT_B
]
=
default_opset
::
Constant
::
create
(
element
::
f32
,
Shape
{
num_directions
,
gates_count
*
hidden_size
},
std
::
vector
<
float
>
(
num_directions
*
gates_count
*
hidden_size
,
...
...
@@ -107,11 +109,13 @@ namespace ngraph
}
else
{
m_map
[
LSTMInput
::
LSTM_INPUT_SEQ_LENGTHS
]
=
ngraph
::
op
::
Constant
::
create
(
m_map
[
LSTMInput
::
LSTM_INPUT_SEQ_LENGTHS
]
=
default_opset
::
Constant
::
create
(
element
::
i32
,
Shape
{
batch_size
},
std
::
vector
<
std
::
int32_t
>
(
batch_size
,
m_map
[
LSTMInput
::
LSTM_INPUT_X
]
->
get_shape
().
at
(
0
)));
batch_size
,
m_map
[
LSTMInput
::
LSTM_INPUT_X
]
->
get_shape
().
at
(
0
)));
}
// The initial value of the hidden.
// Shape [num_directions, batch_size, hidden_size]
...
...
@@ -121,7 +125,7 @@ namespace ngraph
}
else
{
m_map
[
LSTMInput
::
LSTM_INPUT_INIT_H
]
=
ngraph
::
op
::
Constant
::
create
(
m_map
[
LSTMInput
::
LSTM_INPUT_INIT_H
]
=
default_opset
::
Constant
::
create
(
element
::
f32
,
Shape
{
num_directions
,
batch_size
,
hidden_size
},
std
::
vector
<
float
>
(
num_directions
*
batch_size
*
hidden_size
,
0.
f
));
...
...
@@ -134,7 +138,7 @@ namespace ngraph
}
else
{
m_map
[
LSTMInput
::
LSTM_INPUT_INIT_C
]
=
ngraph
::
op
::
Constant
::
create
(
m_map
[
LSTMInput
::
LSTM_INPUT_INIT_C
]
=
default_opset
::
Constant
::
create
(
element
::
f32
,
Shape
{
num_directions
,
batch_size
,
hidden_size
},
std
::
vector
<
float
>
(
num_directions
*
batch_size
*
hidden_size
,
0.
f
));
...
...
@@ -146,7 +150,7 @@ namespace ngraph
}
else
{
m_map
[
LSTMInput
::
LSTM_INPUT_P
]
=
ngraph
::
op
::
Constant
::
create
(
m_map
[
LSTMInput
::
LSTM_INPUT_P
]
=
default_opset
::
Constant
::
create
(
element
::
f32
,
Shape
{
num_directions
,
peepholes_count
*
hidden_size
},
std
::
vector
<
float
>
(
num_directions
*
peepholes_count
*
hidden_size
,
...
...
@@ -188,15 +192,15 @@ namespace ngraph
" is invalid"
);
if
(
direction
==
"forward"
)
{
m_direction
=
ngraph
::
op
::
LSTMSequence
::
direction
::
FORWARD
;
m_direction
=
default_opset
::
LSTMSequence
::
direction
::
FORWARD
;
}
else
if
(
direction
==
"reverse"
)
{
m_direction
=
ngraph
::
op
::
LSTMSequence
::
direction
::
REVERSE
;
m_direction
=
default_opset
::
LSTMSequence
::
direction
::
REVERSE
;
}
else
// (direction == "bidirectional")
{
m_direction
=
ngraph
::
op
::
LSTMSequence
::
direction
::
BIDIRECTIONAL
;
m_direction
=
default_opset
::
LSTMSequence
::
direction
::
BIDIRECTIONAL
;
}
}
...
...
@@ -218,7 +222,7 @@ namespace ngraph
LSTMNgInputMap
input_map
{
node
};
LSTMAttributes
attributes
{
node
};
auto
lstmSequence
=
std
::
make_shared
<
ngraph
::
op
::
LSTMSequence
>
(
auto
lstmSequence
=
std
::
make_shared
<
default_opset
::
LSTMSequence
>
(
input_map
.
at
(
LSTMInput
::
LSTM_INPUT_X
),
input_map
.
at
(
LSTMInput
::
LSTM_INPUT_INIT_H
),
input_map
.
at
(
LSTMInput
::
LSTM_INPUT_INIT_C
),
...
...
@@ -235,9 +239,9 @@ namespace ngraph
attributes
.
m_activations
,
attributes
.
m_clip_threshold
,
attributes
.
m_input_forget
);
return
{
std
::
make_shared
<
ngraph
::
op
::
GetOutputElement
>
(
lstmSequence
,
0
),
std
::
make_shared
<
ngraph
::
op
::
GetOutputElement
>
(
lstmSequence
,
1
),
std
::
make_shared
<
ngraph
::
op
::
GetOutputElement
>
(
lstmSequence
,
2
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
GetOutputElement
>
(
lstmSequence
,
0
),
std
::
make_shared
<
ngraph
::
op
set0
::
GetOutputElement
>
(
lstmSequence
,
1
),
std
::
make_shared
<
ngraph
::
op
set0
::
GetOutputElement
>
(
lstmSequence
,
2
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/matmul.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/fused/matmul.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
NodeVector
matmul
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
MatMul
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
MatMul
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/max.hpp
View file @
d33698fa
...
...
@@ -17,8 +17,9 @@
#pragma once
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op
/maximum
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "utils/variadic.hpp"
namespace
ngraph
...
...
@@ -31,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
max
(
const
Node
&
node
)
{
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
Maximum
>
(
node
);
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
set0
::
Maximum
>
(
node
);
}
}
// namespace set_1
...
...
@@ -40,7 +41,7 @@ namespace ngraph
{
inline
NodeVector
max
(
const
Node
&
node
)
{
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
v1
::
Maximum
>
(
node
);
return
variadic
::
make_ng_variadic_op
<
default_opset
::
Maximum
>
(
node
);
}
}
// namespace set_8
...
...
src/ngraph/frontend/onnx_import/op/mean.cpp
View file @
d33698fa
...
...
@@ -15,9 +15,11 @@
//*****************************************************************************
#include "mean.hpp"
#include "default_opset.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/variadic.hpp"
namespace
ngraph
...
...
@@ -30,12 +32,12 @@ namespace ngraph
{
NodeVector
mean
(
const
Node
&
node
)
{
auto
sum
=
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
Add
>
(
node
).
front
();
auto
sum
=
variadic
::
make_ng_variadic_op
<
ngraph
::
op
set0
::
Add
>
(
node
).
front
();
auto
shape
=
sum
->
get_shape
();
// Create a Constant representing the number of inputs with the same shape as
// sum
auto
count
=
ngraph
::
op
::
Constant
::
create
(
auto
count
=
default_opset
::
Constant
::
create
(
sum
->
get_element_type
(),
shape
,
std
::
vector
<
int
>
(
shape_size
(
shape
),
node
.
get_ng_inputs
().
size
()));
...
...
@@ -49,12 +51,12 @@ namespace ngraph
{
NodeVector
mean
(
const
Node
&
node
)
{
auto
sum
=
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
v1
::
Add
>
(
node
).
front
();
auto
sum
=
variadic
::
make_ng_variadic_op
<
default_opset
::
Add
>
(
node
).
front
();
auto
shape
=
sum
->
get_shape
();
// Create a Constant representing the number of inputs with the same shape as
// sum
auto
count
=
ngraph
::
op
::
Constant
::
create
(
auto
count
=
default_opset
::
Constant
::
create
(
sum
->
get_element_type
(),
shape
,
std
::
vector
<
int
>
(
shape_size
(
shape
),
node
.
get_ng_inputs
().
size
()));
...
...
src/ngraph/frontend/onnx_import/op/mean_variance_normalization.cpp
View file @
d33698fa
...
...
@@ -19,6 +19,7 @@
#include "mean_variance_normalization.hpp"
#include "ngraph/axis_set.hpp"
#include "ngraph/op/fused/mvn.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/common.hpp"
namespace
ngraph
...
...
@@ -37,7 +38,7 @@ namespace ngraph
bool
normalize_variance
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"normalize_variance"
,
1
);
return
{
std
::
make_shared
<
ngraph
::
op
::
MVN
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
MVN
>
(
data
,
across_channels
,
normalize_variance
)};
}
...
...
@@ -52,7 +53,7 @@ namespace ngraph
std
::
vector
<
std
::
size_t
>
valid_axes
=
common
::
validate_axes
(
node
,
axes
,
data
->
get_shape
().
size
());
return
{
std
::
make_shared
<
ngraph
::
op
::
MVN
>
(
data
,
AxisSet
(
valid_axes
))};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
MVN
>
(
data
,
AxisSet
(
valid_axes
))};
}
}
// namespace set_9
...
...
src/ngraph/frontend/onnx_import/op/min.hpp
View file @
d33698fa
...
...
@@ -17,8 +17,9 @@
#pragma once
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op
/minimum
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "utils/variadic.hpp"
namespace
ngraph
...
...
@@ -31,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
min
(
const
Node
&
node
)
{
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
Minimum
>
(
node
);
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
set0
::
Minimum
>
(
node
);
}
}
// namespace set_1
...
...
@@ -40,7 +41,7 @@ namespace ngraph
{
inline
NodeVector
min
(
const
Node
&
node
)
{
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
v1
::
Minimum
>
(
node
);
return
variadic
::
make_ng_variadic_op
<
default_opset
::
Minimum
>
(
node
);
}
}
// namespace set_8
...
...
src/ngraph/frontend/onnx_import/op/mod.cpp
View file @
d33698fa
...
...
@@ -16,6 +16,7 @@
#include <memory>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "mod.hpp"
#include "ngraph/op/abs.hpp"
...
...
@@ -39,7 +40,7 @@ namespace ngraph
ASSERT_IS_SUPPORTED
(
node
,
fmod
==
1
)
<<
"Only 'fmod=1' mode is supported for mod operator."
;
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Mod
>
(
dividend
,
divisor
)};
return
{
std
::
make_shared
<
default_opset
::
Mod
>
(
dividend
,
divisor
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/mul.hpp
View file @
d33698fa
...
...
@@ -19,10 +19,12 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -41,8 +43,8 @@ namespace ngraph
NodeVector
ng_inputs
{
ngraph
::
op
::
legacy_style_broadcast_for_binary_operation
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
),
axis
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Multiply
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
return
{
std
::
make_shared
<
ngraph
::
opset0
::
Multiply
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
}
}
// namespace set_1
...
...
@@ -51,7 +53,7 @@ namespace ngraph
{
inline
NodeVector
mul
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Multiply
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Multiply
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/non_max_suppression.cpp
View file @
d33698fa
...
...
@@ -16,8 +16,8 @@
#include <memory>
#include "
ngraph/frontend/onnx_import/exceptions
.hpp"
#include "
ngraph/op/constant
.hpp"
#include "
default_opset
.hpp"
#include "
exceptions
.hpp"
#include "ngraph/op/non_max_suppression.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "non_max_suppression.hpp"
...
...
@@ -47,7 +47,7 @@ namespace ngraph
else
{
max_output_boxes_per_class
=
ngraph
::
op
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
0
});
default_opset
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
0
});
}
std
::
shared_ptr
<
ngraph
::
Node
>
iou_threshold
;
...
...
@@ -57,7 +57,8 @@ namespace ngraph
}
else
{
iou_threshold
=
ngraph
::
op
::
Constant
::
create
(
element
::
f32
,
Shape
{},
{
.0
f
});
iou_threshold
=
default_opset
::
Constant
::
create
(
element
::
f32
,
Shape
{},
{
.0
f
});
}
std
::
shared_ptr
<
ngraph
::
Node
>
score_threshold
;
...
...
@@ -68,7 +69,7 @@ namespace ngraph
else
{
score_threshold
=
ngraph
::
op
::
Constant
::
create
(
element
::
f32
,
Shape
{},
{
.0
f
});
default_opset
::
Constant
::
create
(
element
::
f32
,
Shape
{},
{
.0
f
});
}
const
auto
center_point_box
=
...
...
@@ -79,10 +80,10 @@ namespace ngraph
const
auto
box_encoding
=
center_point_box
==
0
?
ngraph
::
op
::
v1
::
NonMaxSuppression
::
BoxEncodingType
::
CORNER
:
ngraph
::
op
::
v1
::
NonMaxSuppression
::
BoxEncodingType
::
CENTER
;
?
default_opset
::
NonMaxSuppression
::
BoxEncodingType
::
CORNER
:
default_opset
::
NonMaxSuppression
::
BoxEncodingType
::
CENTER
;
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
NonMaxSuppression
>
(
return
{
std
::
make_shared
<
default_opset
::
NonMaxSuppression
>
(
boxes
,
scores
,
max_output_boxes_per_class
,
...
...
src/ngraph/frontend/onnx_import/op/not.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/not.hpp"
namespace
ngraph
{
...
...
@@ -33,7 +33,7 @@ namespace ngraph
inline
NodeVector
logical_not
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
LogicalNot
>
(
node
.
get_ng_inputs
().
at
(
0
))};
std
::
make_shared
<
default_opset
::
LogicalNot
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/onehot.cpp
View file @
d33698fa
...
...
@@ -17,9 +17,8 @@
#include <cstdint>
#include <memory>
#include "ngraph/op/convert.hpp"
#include "ngraph/op/one_hot.hpp"
#include "ngraph/op/slice.hpp"
#include "default_opset.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "onehot.hpp"
#include "utils/common.hpp"
#include "utils/reshape.hpp"
...
...
@@ -36,18 +35,20 @@ namespace ngraph
{
NodeVector
inputs
{
node
.
get_ng_inputs
()};
auto
indices
=
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
inputs
.
at
(
0
),
element
::
i64
);
std
::
make_shared
<
default_opset
::
Convert
>
(
inputs
.
at
(
0
),
element
::
i64
);
auto
depth
=
reshape
::
interpret_as_scalar
(
inputs
.
at
(
1
));
auto
values
=
inputs
.
at
(
2
);
std
::
shared_ptr
<
ngraph
::
Node
>
off_value
=
reshape
::
interpret_as_scalar
(
std
::
make_shared
<
ngraph
::
op
::
Slice
>
(
values
,
Coordinate
{
0
},
Coordinate
{
1
}));
std
::
shared_ptr
<
ngraph
::
Node
>
on_value
=
reshape
::
interpret_as_scalar
(
std
::
make_shared
<
ngraph
::
op
::
Slice
>
(
values
,
Coordinate
{
1
},
Coordinate
{
2
}));
std
::
shared_ptr
<
ngraph
::
Node
>
off_value
=
reshape
::
interpret_as_scalar
(
std
::
make_shared
<
ngraph
::
opset0
::
Slice
>
(
values
,
Coordinate
{
0
},
Coordinate
{
1
}));
std
::
shared_ptr
<
ngraph
::
Node
>
on_value
=
reshape
::
interpret_as_scalar
(
std
::
make_shared
<
ngraph
::
opset0
::
Slice
>
(
values
,
Coordinate
{
1
},
Coordinate
{
2
}));
auto
axis
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"axis"
,
-
1
);
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
OneHot
>
(
return
{
std
::
make_shared
<
default_opset
::
OneHot
>
(
indices
,
depth
,
on_value
,
off_value
,
axis
)};
}
...
...
src/ngraph/frontend/onnx_import/op/or.hpp
View file @
d33698fa
...
...
@@ -19,9 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/or.hpp"
#include "ngraph/op/util/broadcasting.hpp"
namespace
ngraph
{
...
...
@@ -33,8 +32,8 @@ namespace ngraph
{
inline
NodeVector
logical_or
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
LogicalOr
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
return
{
std
::
make_shared
<
default_opset
::
LogicalOr
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/pad.cpp
View file @
d33698fa
...
...
@@ -16,6 +16,7 @@
#include <memory>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/coordinate_diff.hpp"
#include "ngraph/op/constant.hpp"
...
...
@@ -60,13 +61,13 @@ namespace ngraph
ngraph
::
CoordinateDiff
padding_below
=
paddings
.
first
;
ngraph
::
CoordinateDiff
padding_above
=
paddings
.
second
;
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Pad
>
(
return
{
std
::
make_shared
<
default_opset
::
Pad
>
(
data
,
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
std
::
make_shared
<
default_opset
::
Constant
>
(
element
::
i64
,
ngraph
::
Shape
{
padding_below
.
size
()},
padding_below
),
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
std
::
make_shared
<
default_opset
::
Constant
>
(
element
::
i64
,
ngraph
::
Shape
{
padding_above
.
size
()},
padding_above
),
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
ngraph
::
Shape
{},
std
::
vector
<
double
>
{
value
}),
pad_mode
)};
}
...
...
src/ngraph/frontend/onnx_import/op/pow.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/power.hpp"
#include "ngraph/op/util/broadcasting.hpp"
namespace
ngraph
...
...
@@ -33,7 +33,7 @@ namespace ngraph
{
inline
NodeVector
pow
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Power
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Power
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/prelu.cpp
View file @
d33698fa
...
...
@@ -16,7 +16,7 @@
#include <memory>
#include "
ngraph/op/fused/prelu
.hpp"
#include "
default_opset
.hpp"
#include "prelu.hpp"
namespace
ngraph
...
...
@@ -32,7 +32,7 @@ namespace ngraph
NodeVector
ng_inputs
{
node
.
get_ng_inputs
()};
const
auto
&
data
=
ng_inputs
.
at
(
0
);
const
auto
&
slope
=
ng_inputs
.
at
(
1
);
return
{
std
::
make_shared
<
ngraph
::
op
::
PRelu
>
(
data
,
slope
)};
return
{
std
::
make_shared
<
default_opset
::
PRelu
>
(
data
,
slope
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/quant_conv.cpp
View file @
d33698fa
...
...
@@ -18,14 +18,13 @@
#include <memory>
#include <vector>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/builder/quantization/quantized_linear_convolution.hpp"
#include "ngraph/coordinate_diff.hpp"
#include "ngraph/frontend/onnx_import/utils/convpool.hpp"
#include "ngraph/op/concat.hpp"
#include "ngraph/op/quantized_convolution.hpp"
#include "ngraph/op/slice.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/strides.hpp"
#include "quant_conv.hpp"
...
...
@@ -102,12 +101,12 @@ namespace ngraph
// slice data
data_lower_bounds
[
1
]
=
group
*
data_group_size
;
data_upper_bounds
[
1
]
=
(
group
+
1
)
*
data_group_size
;
auto
sliced_data
=
std
::
make_shared
<
ngraph
::
op
::
Slice
>
(
auto
sliced_data
=
std
::
make_shared
<
ngraph
::
op
set0
::
Slice
>
(
data
,
data_lower_bounds
,
data_upper_bounds
);
// slice filters
filters_lower_bounds
[
0
]
=
group
*
filters_group_size
;
filters_upper_bounds
[
0
]
=
(
group
+
1
)
*
filters_group_size
;
auto
sliced_filters
=
std
::
make_shared
<
ngraph
::
op
::
Slice
>
(
auto
sliced_filters
=
std
::
make_shared
<
ngraph
::
op
set0
::
Slice
>
(
filters
,
filters_lower_bounds
,
filters_upper_bounds
);
if
(
bias
)
...
...
@@ -119,7 +118,7 @@ namespace ngraph
else
{
convolution_nodes
.
push_back
(
std
::
make_shared
<
ngraph
::
op
::
QuantizedConvolution
>
(
std
::
make_shared
<
ngraph
::
op
set0
::
QuantizedConvolution
>
(
sliced_data
,
sliced_filters
,
strides
,
...
...
@@ -140,7 +139,7 @@ namespace ngraph
}
}
std
::
size_t
concatenation_axis
=
1
;
return
std
::
make_shared
<
ngraph
::
op
::
Concat
>
(
convolution_nodes
,
return
std
::
make_shared
<
default_opset
::
Concat
>
(
convolution_nodes
,
concatenation_axis
);
}
else
...
...
@@ -162,7 +161,7 @@ namespace ngraph
}
else
{
return
std
::
make_shared
<
ngraph
::
op
::
QuantizedConvolution
>
(
return
std
::
make_shared
<
ngraph
::
op
set0
::
QuantizedConvolution
>
(
data
,
filters
,
strides
,
...
...
src/ngraph/frontend/onnx_import/op/quantize_linear.cpp
View file @
d33698fa
...
...
@@ -18,7 +18,7 @@
#include <memory>
#include "ngraph/axis_set.hpp"
#include "ngraph/op
/quantize
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "ngraph/shape.hpp"
#include "quantize_linear.hpp"
...
...
@@ -61,13 +61,13 @@ namespace ngraph
Shape
y_scale_shape
=
y_scale
->
get_shape
();
Shape
y_zero_point_shape
=
y_zero_point
->
get_shape
();
return
{
std
::
make_shared
<
ngraph
::
op
::
Quantize
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Quantize
>
(
x
,
y_scale
,
y_zero_point
,
y_zero_point
->
get_element_type
(),
axes
,
ngraph
::
op
::
Quantize
::
RoundMode
::
ROUND_NEAREST_TOWARD_EVEN
)};
ngraph
::
op
set0
::
Quantize
::
RoundMode
::
ROUND_NEAREST_TOWARD_EVEN
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/reciprocal.cpp
View file @
d33698fa
...
...
@@ -17,8 +17,8 @@
#include <memory>
#include <vector>
#include "ngraph/op/fused/reciprocal.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/shape.hpp"
#include "reciprocal.hpp"
...
...
@@ -34,7 +34,7 @@ namespace ngraph
{
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
return
{
std
::
make_shared
<
ngraph
::
op
::
Reciprocal
>
(
data
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Reciprocal
>
(
data
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/reduce.cpp
View file @
d33698fa
...
...
@@ -18,8 +18,7 @@
#include <iterator> // std::begin, std::end
#include <numeric> // std::accumulate
#include "ngraph/op/constant.hpp"
#include "ngraph/op/divide.hpp"
#include "default_opset.hpp"
#include "ngraph/shape.hpp"
#include "reduce.hpp"
...
...
@@ -46,17 +45,17 @@ namespace ngraph
auto
sum_node
=
std
::
shared_ptr
<
ngraph
::
Node
>
{
reduction
::
make_ng_reduction_op
(
node
,
node
.
get_ng_inputs
().
at
(
0
),
std
::
make_shared
<
ngraph
::
op
::
Sum
,
std
::
make_shared
<
ngraph
::
op
set0
::
Sum
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
ngraph
::
AxisSet
&>
)};
auto
const_node
=
ngraph
::
op
::
Constant
::
create
(
auto
const_node
=
default_opset
::
Constant
::
create
(
sum_node
->
get_element_type
(),
sum_node
->
get_shape
(),
std
::
vector
<
std
::
size_t
>
(
shape_size
(
sum_node
->
get_shape
()),
elem_count_product
));
return
{
std
::
make_shared
<
ngraph
::
op
::
Divide
>
(
sum_node
,
const_node
)};
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Divide
>
(
sum_node
,
const_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/reduce.hpp
View file @
d33698fa
...
...
@@ -20,6 +20,7 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/builder/norm.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/abs.hpp"
...
...
@@ -32,6 +33,7 @@
#include "ngraph/op/reduce_sum.hpp"
#include "ngraph/op/sum.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/reduction.hpp"
namespace
ngraph
...
...
@@ -59,10 +61,10 @@ namespace ngraph
std
::
shared_ptr
<
ngraph
::
Node
>
sum_node
{
reduction
::
make_ng_reduction_op
(
node
,
node
.
get_ng_inputs
().
at
(
0
),
std
::
make_shared
<
ngraph
::
op
::
Sum
,
std
::
make_shared
<
ngraph
::
op
set0
::
Sum
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
ngraph
::
AxisSet
&>
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
sum_node
)};
return
{
std
::
make_shared
<
default_opset
::
Log
>
(
sum_node
)};
}
/// \brief Compute the log sum exponent of the input tensor's elements along
...
...
@@ -79,14 +81,15 @@ namespace ngraph
///
inline
NodeVector
reduce_log_sum_exp
(
const
Node
&
node
)
{
auto
exp_node
=
std
::
make_shared
<
ngraph
::
op
::
Exp
>
(
node
.
get_ng_inputs
().
at
(
0
));
auto
exp_node
=
std
::
make_shared
<
default_opset
::
Exp
>
(
node
.
get_ng_inputs
().
at
(
0
));
std
::
shared_ptr
<
ngraph
::
Node
>
sum_node
{
reduction
::
make_ng_reduction_op
(
node
,
exp_node
,
std
::
make_shared
<
ngraph
::
op
::
Sum
,
std
::
make_shared
<
ngraph
::
op
set0
::
Sum
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
ngraph
::
AxisSet
&>
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
sum_node
)};
return
{
std
::
make_shared
<
default_opset
::
Log
>
(
sum_node
)};
}
/// \brief Compute the L1 norm of the input tensor's element along the provided
...
...
@@ -152,7 +155,7 @@ namespace ngraph
return
{
reduction
::
make_ng_reduction_op
(
node
,
node
.
get_ng_inputs
().
at
(
0
),
std
::
make_shared
<
ngraph
::
op
::
Max
,
std
::
make_shared
<
ngraph
::
op
set0
::
Max
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
ngraph
::
AxisSet
&>
)};
}
...
...
@@ -188,7 +191,7 @@ namespace ngraph
return
{
reduction
::
make_ng_reduction_op
(
node
,
node
.
get_ng_inputs
().
at
(
0
),
std
::
make_shared
<
ngraph
::
op
::
Min
,
std
::
make_shared
<
ngraph
::
op
set0
::
Min
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
ngraph
::
AxisSet
&>
)};
}
...
...
@@ -210,7 +213,7 @@ namespace ngraph
return
{
reduction
::
make_ng_reduction_op
(
node
,
node
.
get_ng_inputs
().
at
(
0
),
std
::
make_shared
<
ngraph
::
op
::
v1
::
ReduceProd
,
std
::
make_shared
<
default_opset
::
ReduceProd
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
bool
>
)};
...
...
@@ -233,7 +236,7 @@ namespace ngraph
return
{
reduction
::
make_ng_reduction_op
(
node
,
node
.
get_ng_inputs
().
at
(
0
),
std
::
make_shared
<
ngraph
::
op
::
v1
::
ReduceSum
,
std
::
make_shared
<
default_opset
::
ReduceSum
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
bool
>
)};
...
...
@@ -258,7 +261,7 @@ namespace ngraph
return
{
reduction
::
make_ng_reduction_op
(
node
,
square_node
,
std
::
make_shared
<
ngraph
::
op
::
Sum
,
std
::
make_shared
<
ngraph
::
op
set0
::
Sum
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
,
const
ngraph
::
AxisSet
&>
)};
}
...
...
src/ngraph/frontend/onnx_import/op/relu.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/relu.hpp"
namespace
ngraph
{
...
...
@@ -33,7 +33,7 @@ namespace ngraph
inline
NodeVector
relu
(
const
Node
&
node
)
{
NodeVector
ng_inputs
{
node
.
get_ng_inputs
()};
return
{
std
::
make_shared
<
ngraph
::
op
::
Relu
>
(
ng_inputs
.
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Relu
>
(
ng_inputs
.
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/reshape.cpp
View file @
d33698fa
...
...
@@ -18,10 +18,9 @@
#include <memory>
#include <vector>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/axis_vector.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/reshape.hpp"
#include "ngraph/shape.hpp"
#include "reshape.hpp"
#include "utils/reshape.hpp"
...
...
@@ -54,11 +53,11 @@ namespace ngraph
const
auto
output_shape
=
node
.
get_attribute_value
<
std
::
vector
<
int64_t
>>
(
"shape"
,
{});
pattern
=
ngraph
::
op
::
Constant
::
create
(
pattern
=
default_opset
::
Constant
::
create
(
element
::
i64
,
Shape
{
output_shape
.
size
()},
output_shape
);
}
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Reshape
>
(
data
,
pattern
,
true
)};
return
{
std
::
make_shared
<
default_opset
::
Reshape
>
(
data
,
pattern
,
true
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/reverse_sequence.cpp
View file @
d33698fa
...
...
@@ -17,9 +17,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/convert.hpp"
#include "ngraph/op/reverse_sequence.hpp"
#include "ngraph/type/element_type.hpp"
#include "reverse_sequence.hpp"
#include "utils/common.hpp"
...
...
@@ -38,7 +37,7 @@ namespace ngraph
const
auto
sequence_lengths
=
node
.
get_ng_inputs
().
at
(
1
);
// nGraph supports only int32 type of sequence_lengths
const
auto
sequence_lengths_i32
=
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
const
auto
sequence_lengths_i32
=
std
::
make_shared
<
default_opset
::
Convert
>
(
node
.
get_ng_inputs
().
at
(
1
),
element
::
i32
);
const
auto
batch_axis
=
node
.
get_attribute_value
<
int64_t
>
(
"batch_axis"
,
1
);
...
...
@@ -60,7 +59,7 @@ namespace ngraph
"'batch_axis' and 'time_axis' attributes of the ReverseSequence "
"operator can't point to the same dimension"
);
return
{
std
::
make_shared
<
ngraph
::
op
::
ReverseSequence
>
(
return
{
std
::
make_shared
<
default_opset
::
ReverseSequence
>
(
data
,
sequence_lengths_i32
,
valid_batch_axis
,
valid_time_axis
)};
}
...
...
src/ngraph/frontend/onnx_import/op/selu.cpp
View file @
d33698fa
...
...
@@ -17,12 +17,11 @@
#include <memory>
#include <vector>
#include "default_opset.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/selu.hpp"
#include "selu.hpp"
using
namespace
ngraph
::
op
;
namespace
ngraph
{
namespace
onnx_import
...
...
@@ -39,13 +38,13 @@ namespace ngraph
auto
gamma
=
node
.
get_attribute_value
<
double
>
(
"gamma"
,
1.05070102214813232421875
);
auto
alpha_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
auto
alpha_node
=
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
double
>
{
alpha
});
auto
gamma_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
auto
gamma_node
=
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
double
>
{
gamma
});
return
{
std
::
make_shared
<
ngraph
::
op
::
v0
::
Selu
>
(
data
,
alpha_node
,
gamma_node
)};
return
{
std
::
make_shared
<
default_opset
::
Selu
>
(
data
,
alpha_node
,
gamma_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/shape.cpp
View file @
d33698fa
...
...
@@ -16,8 +16,8 @@
#include <memory>
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type.hpp"
#include "shape.hpp"
...
...
@@ -35,7 +35,7 @@ namespace ngraph
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
auto
data_shape
=
data
->
get_shape
();
return
{
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
return
{
std
::
make_shared
<
default_opset
::
Constant
>
(
ngraph
::
element
::
i64
,
Shape
{
data_shape
.
size
()},
data_shape
)};
}
...
...
src/ngraph/frontend/onnx_import/op/shrink.cpp
View file @
d33698fa
...
...
@@ -16,14 +16,12 @@
#include <memory>
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/convert.hpp"
#include "ngraph/op/greater.hpp"
#include "ngraph/op/less.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/subtract.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "shrink.hpp"
namespace
ngraph
...
...
@@ -43,40 +41,40 @@ namespace ngraph
ASSERT_VALID_ARGUMENT
(
node
,
!
(
lambd
<
0.0
f
))
<<
" The provided 'lambd' value:"
<<
lambd
<<
" must not be negative."
;
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
negative_lambd
;
std
::
shared_ptr
<
default_opset
::
Constant
>
negative_lambd
;
const
auto
input_element_type
=
input
->
get_element_type
();
if
(
input_element_type
.
is_signed
())
{
negative_lambd
=
ngraph
::
op
::
Constant
::
create
(
negative_lambd
=
default_opset
::
Constant
::
create
(
input_element_type
,
input
->
get_shape
(),
{
-
lambd
});
}
else
{
// Passing -lambd to unsigned type constant will cause an overflow.
// For unsigned types the lowest possible value is 0.
negative_lambd
=
ngraph
::
op
::
Constant
::
create
(
negative_lambd
=
default_opset
::
Constant
::
create
(
input_element_type
,
input
->
get_shape
(),
{
0
});
}
const
auto
positive_lambd
=
ngraph
::
op
::
Constant
::
create
(
const
auto
positive_lambd
=
default_opset
::
Constant
::
create
(
input_element_type
,
input
->
get_shape
(),
{
lambd
});
const
auto
bias_tensor
=
ngraph
::
op
::
Constant
::
create
(
const
auto
bias_tensor
=
default_opset
::
Constant
::
create
(
input_element_type
,
input
->
get_shape
(),
{
bias
});
// Create a mask indicating locations of values that need to be adjusted
// 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
::
op
::
Less
>
(
input
,
negative_lambd
);
std
::
make_shared
<
ngraph
::
op
set0
::
Less
>
(
input
,
negative_lambd
);
std
::
shared_ptr
<
ngraph
::
Node
>
values_above_pos_lambd
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Greater
>
(
input
,
positive_lambd
);
std
::
make_shared
<
default_opset
::
Greater
>
(
input
,
positive_lambd
);
// Convert from bool to the input type to be able to multiply adjusted inputs
// by the created masks
values_below_neg_lambd
=
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
values_below_neg_lambd
=
std
::
make_shared
<
default_opset
::
Convert
>
(
values_below_neg_lambd
,
input_element_type
);
values_above_pos_lambd
=
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
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
;
...
...
src/ngraph/frontend/onnx_import/op/sigmoid.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/sigmoid.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
sigmoid
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Sigmoid
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Sigmoid
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/sign.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/sign.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
sign
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Sign
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Sign
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/sin.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/sin.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
sin
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Sin
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Sin
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/sinh.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/sinh.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
sinh
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Sinh
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Sinh
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/size.cpp
View file @
d33698fa
...
...
@@ -18,7 +18,7 @@
#include <memory>
#include <vector>
#include "
ngraph/op/constan
t.hpp"
#include "
default_opse
t.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type.hpp"
#include "size.hpp"
...
...
@@ -37,7 +37,7 @@ namespace ngraph
std
::
int64_t
tensor_elements_count
{
static_cast
<
std
::
int64_t
>
(
shape_size
(
data
->
get_shape
()))};
return
{
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
return
{
std
::
make_shared
<
default_opset
::
Constant
>
(
ngraph
::
element
::
i64
,
Shape
{},
std
::
vector
<
std
::
int64_t
>
{
tensor_elements_count
})};
...
...
src/ngraph/frontend/onnx_import/op/slice.cpp
View file @
d33698fa
...
...
@@ -19,7 +19,7 @@
#include <vector>
#include "ngraph/node.hpp"
#include "ngraph/op
/slice
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "slice.hpp"
#include "utils/common.hpp"
...
...
@@ -72,7 +72,8 @@ namespace ngraph
}
}
return
{
std
::
make_shared
<
ngraph
::
op
::
Slice
>
(
data
,
lower_bounds
,
upper_bounds
)};
return
{
std
::
make_shared
<
ngraph
::
opset0
::
Slice
>
(
data
,
lower_bounds
,
upper_bounds
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/softmax.cpp
View file @
d33698fa
...
...
@@ -16,7 +16,7 @@
#include <memory>
#include "
ngraph/op/softmax
.hpp"
#include "
default_opset
.hpp"
#include "softmax.hpp"
#include "utils/common.hpp"
...
...
@@ -37,7 +37,7 @@ namespace ngraph
int
axis
=
node
.
get_attribute_value
<
int64_t
>
(
"axis"
,
1
);
std
::
size_t
valid_axis
=
common
::
validate_axis
(
node
,
axis
,
data_shape
.
size
());
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Softmax
>
(
data
,
valid_axis
)};
return
{
std
::
make_shared
<
default_opset
::
Softmax
>
(
data
,
valid_axis
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/softplus.cpp
View file @
d33698fa
...
...
@@ -16,14 +16,12 @@
#include <memory>
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/exp.hpp"
#include "ngraph/op/greater.hpp"
#include "ngraph/op/log.hpp"
#include "ngraph/op/negative.hpp"
#include "ngraph/op/select.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "softplus.hpp"
namespace
ngraph
...
...
@@ -39,30 +37,31 @@ namespace ngraph
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
std
::
shared_ptr
<
ngraph
::
Node
>
zero_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
{
0.
f
});
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
=
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
float
>
{
1.
f
});
std
::
shared_ptr
<
ngraph
::
Node
>
positive_val_node
=
data
+
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
std
::
make_shared
<
ngraph
::
op
::
Exp
>
(
std
::
make_shared
<
ngraph
::
op
::
Negative
>
(
data
))
+
data
+
std
::
make_shared
<
default_opset
::
Log
>
(
std
::
make_shared
<
default_opset
::
Exp
>
(
std
::
make_shared
<
default_opset
::
Negative
>
(
data
))
+
one_node
);
std
::
shared_ptr
<
ngraph
::
Node
>
negative_val_node
=
std
::
make_shared
<
ngraph
::
op
::
Log
>
(
std
::
make_shared
<
ngraph
::
op
::
Exp
>
(
data
)
+
one_node
);
std
::
make_shared
<
default_opset
::
Log
>
(
std
::
make_shared
<
default_opset
::
Exp
>
(
data
)
+
one_node
);
std
::
shared_ptr
<
ngraph
::
Node
>
condition_node
=
std
::
make_shared
<
ngraph
::
op
::
Greater
>
(
data
,
zero_node
);
std
::
make_shared
<
ngraph
::
op
set0
::
Greater
>
(
data
,
zero_node
);
//
// This equation represents:
// x + log(exp(-x) + 1) - for x > 0; to manage exponent overflow,
// log(exp(x) + 1) - elsewhere.
//
return
{
std
::
make_shared
<
ngraph
::
op
::
Select
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Select
>
(
condition_node
,
positive_val_node
,
negative_val_node
)};
}
...
...
src/ngraph/frontend/onnx_import/op/softsign.cpp
View file @
d33698fa
...
...
@@ -17,9 +17,9 @@
#include <memory>
#include <vector>
#include "default_opset.hpp"
#include "ngraph/op/abs.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/shape.hpp"
...
...
@@ -37,11 +37,12 @@ namespace ngraph
{
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
std
::
shared_ptr
<
ngraph
::
Node
>
one_node
=
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
Shape
{},
std
::
vector
<
double
>
{
1
});
one_node
=
ngraph
::
op
::
make_broadcast_node
(
one_node
,
data
->
get_shape
());
return
{
data
/
(
std
::
make_shared
<
ngraph
::
op
::
Abs
>
(
data
)
+
one_node
)};
return
{
data
/
(
std
::
make_shared
<
default_opset
::
Abs
>
(
data
)
+
one_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/space_to_depth.cpp
View file @
d33698fa
...
...
@@ -14,8 +14,8 @@
// limitations under the License.
//*****************************************************************************
#include "ngraph/op/fused/space_to_depth.hpp"
#include "space_to_depth.hpp"
#include "default_opset.hpp"
namespace
ngraph
{
...
...
@@ -29,9 +29,9 @@ namespace ngraph
{
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
std
::
size_t
block_size
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"blocksize"
);
const
auto
mode
=
ngraph
::
op
::
SpaceToDepth
::
SpaceToDepthMode
::
BLOCKS_FIRST
;
const
auto
mode
=
default_opset
::
SpaceToDepth
::
SpaceToDepthMode
::
BLOCKS_FIRST
;
return
NodeVector
{
std
::
make_shared
<
ngraph
::
op
::
SpaceToDepth
>
(
data
,
mode
,
block_size
)};
std
::
make_shared
<
default_opset
::
SpaceToDepth
>
(
data
,
mode
,
block_size
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/split.cpp
View file @
d33698fa
...
...
@@ -17,9 +17,7 @@
#include <cstdint>
#include <vector>
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/split.hpp"
#include "ngraph/op/variadic_split.hpp"
#include "default_opset.hpp"
#include "split.hpp"
#include "utils/common.hpp"
...
...
@@ -36,7 +34,7 @@ namespace ngraph
const
auto
input
=
node
.
get_ng_inputs
().
at
(
0
);
const
auto
axis
=
node
.
get_attribute_value
<
int64_t
>
(
"axis"
,
0
);
const
auto
axis_node
=
ngraph
::
op
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
axis
});
default_opset
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
axis
});
std
::
shared_ptr
<
ngraph
::
Node
>
split
;
if
(
node
.
has_attribute
(
"split"
))
...
...
@@ -44,16 +42,16 @@ namespace ngraph
const
auto
splits
=
node
.
get_attribute_value
<
std
::
vector
<
std
::
size_t
>>
(
"split"
);
const
auto
split_lengths
=
ngraph
::
op
::
Constant
::
create
(
const
auto
split_lengths
=
default_opset
::
Constant
::
create
(
element
::
u64
,
Shape
{
splits
.
size
()},
splits
);
split
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
VariadicSplit
>
(
split
=
std
::
make_shared
<
default_opset
::
VariadicSplit
>
(
input
,
axis_node
,
split_lengths
);
}
else
{
const
auto
outputs_number
=
node
.
get_output_names
().
size
();
split
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
Split
>
(
split
=
std
::
make_shared
<
default_opset
::
Split
>
(
input
,
axis_node
,
outputs_number
);
}
return
common
::
get_outputs
(
split
);
...
...
src/ngraph/frontend/onnx_import/op/sqrt.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/sqrt.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
sqrt
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Sqrt
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Sqrt
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/squeeze.cpp
View file @
d33698fa
...
...
@@ -37,9 +37,9 @@ namespace ngraph
node
.
get_attribute_value
<
std
::
vector
<
std
::
int64_t
>>
(
"axes"
,
{});
std
::
vector
<
std
::
size_t
>
valid_axes
=
common
::
validate_axes
(
node
,
axes
,
data
->
get_shape
().
size
());
auto
axes_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
auto
axes_node
=
std
::
make_shared
<
default_opset
::
Constant
>
(
element
::
u64
,
Shape
{
valid_axes
.
size
()},
valid_axes
);
return
{
std
::
make_shared
<
ngraph
::
op
::
Squeeze
>
(
data
,
axes_node
)};
return
{
std
::
make_shared
<
default_opset
::
Squeeze
>
(
data
,
axes_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/sub.hpp
View file @
d33698fa
...
...
@@ -17,9 +17,10 @@
#pragma once
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/subtract.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -38,8 +39,8 @@ namespace ngraph
NodeVector
ng_inputs
{
ngraph
::
op
::
legacy_style_broadcast_for_binary_operation
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
),
axis
)};
return
{
std
::
make_shared
<
ngraph
::
op
::
Subtract
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
return
{
std
::
make_shared
<
ngraph
::
opset0
::
Subtract
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
))};
}
}
// namespace set_1
...
...
@@ -48,7 +49,7 @@ namespace ngraph
{
inline
NodeVector
sub
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
Subtract
>
(
node
.
get_ng_inputs
().
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
Subtract
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
))};
}
...
...
src/ngraph/frontend/onnx_import/op/sum.hpp
View file @
d33698fa
...
...
@@ -17,8 +17,9 @@
#pragma once
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op
/add
.hpp"
#include "ngraph/op
sets/opset0
.hpp"
#include "utils/variadic.hpp"
namespace
ngraph
...
...
@@ -31,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
sum
(
const
Node
&
node
)
{
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
Add
>
(
node
);
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
set0
::
Add
>
(
node
);
}
}
// namespace set_1
...
...
@@ -40,7 +41,7 @@ namespace ngraph
{
inline
NodeVector
sum
(
const
Node
&
node
)
{
return
variadic
::
make_ng_variadic_op
<
ngraph
::
op
::
v1
::
Add
>
(
node
);
return
variadic
::
make_ng_variadic_op
<
default_opset
::
Add
>
(
node
);
}
}
// namespace set_8
...
...
src/ngraph/frontend/onnx_import/op/tan.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/tan.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
tan
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Tan
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Tan
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/tanh.hpp
View file @
d33698fa
...
...
@@ -19,8 +19,8 @@
#include <memory>
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/tanh.hpp"
namespace
ngraph
{
...
...
@@ -32,7 +32,7 @@ namespace ngraph
{
inline
NodeVector
tanh
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
Tanh
>
(
node
.
get_ng_inputs
().
at
(
0
))};
return
{
std
::
make_shared
<
default_opset
::
Tanh
>
(
node
.
get_ng_inputs
().
at
(
0
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/thresholded_relu.cpp
View file @
d33698fa
...
...
@@ -17,11 +17,10 @@
#include <memory>
#include <vector>
#include "ngraph/op/constant.hpp"
#include "ngraph/op/convert.hpp"
#include "ngraph/op/greater.hpp"
#include "default_opset.hpp"
#include "ngraph/op/multiply.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "thresholded_relu.hpp"
namespace
ngraph
...
...
@@ -38,17 +37,17 @@ namespace ngraph
double
alpha
=
node
.
get_attribute_value
<
double
>
(
"alpha"
,
1.0
);
std
::
shared_ptr
<
ngraph
::
Node
>
alpha_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
data
->
get_element_type
(),
std
::
make_shared
<
default_opset
::
Constant
>
(
data
->
get_element_type
(),
data
->
get_shape
(),
std
::
vector
<
double
>
{
alpha
});
auto
data_map
=
std
::
make_shared
<
ngraph
::
op
::
Convert
>
(
std
::
make_shared
<
ngraph
::
op
::
Greater
>
(
data
,
alpha_node
),
auto
data_map
=
std
::
make_shared
<
default_opset
::
Convert
>
(
std
::
make_shared
<
ngraph
::
op
set0
::
Greater
>
(
data
,
alpha_node
),
data
->
get_element_type
());
return
{
data
*
data_map
};
}
}
// namespace set_1
}
// namespace set_1
default_opset
}
// namespace op
...
...
src/ngraph/frontend/onnx_import/op/topk.cpp
View file @
d33698fa
...
...
@@ -17,10 +17,11 @@
#include <cstdint>
#include <memory>
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/get_output_element.hpp"
#include "ngraph/op/topk.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type.hpp"
#include "topk.hpp"
...
...
@@ -54,9 +55,9 @@ namespace
ngraph
::
NodeVector
get_outputs
(
const
std
::
shared_ptr
<
ngraph
::
Node
>&
node
)
{
std
::
shared_ptr
<
ngraph
::
Node
>
values
=
std
::
make_shared
<
ngraph
::
op
::
GetOutputElement
>
(
node
,
0
);
std
::
make_shared
<
ngraph
::
op
set0
::
GetOutputElement
>
(
node
,
0
);
std
::
shared_ptr
<
ngraph
::
Node
>
indices
=
std
::
make_shared
<
ngraph
::
op
::
GetOutputElement
>
(
node
,
1
);
std
::
make_shared
<
ngraph
::
op
set0
::
GetOutputElement
>
(
node
,
1
);
return
{
values
,
indices
};
}
...
...
@@ -74,15 +75,15 @@ namespace ngraph
{
auto
data
=
node
.
get_ng_inputs
().
at
(
0
);
std
::
int64_t
k
{
node
.
get_attribute_value
<
std
::
int64_t
>
(
"k"
)};
auto
k_node
=
ngraph
::
op
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
k
});
auto
k_node
=
default_opset
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
k
});
auto
axis
=
get_axis
(
node
);
std
::
shared_ptr
<
ngraph
::
Node
>
top_k
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
TopK
>
(
std
::
shared_ptr
<
ngraph
::
Node
>
top_k
=
std
::
make_shared
<
default_opset
::
TopK
>
(
data
,
k_node
,
axis
,
ngraph
::
op
::
v1
::
TopK
::
Mode
::
MAX
,
ngraph
::
op
::
v1
::
TopK
::
SortType
::
SORT_VALUES
,
default_opset
::
TopK
::
Mode
::
MAX
,
default_opset
::
TopK
::
SortType
::
SORT_VALUES
,
element
::
i64
);
return
get_outputs
(
top_k
);
...
...
@@ -97,12 +98,12 @@ namespace ngraph
auto
k
=
get_k
(
node
);
auto
axis
=
get_axis
(
node
);
std
::
shared_ptr
<
ngraph
::
Node
>
top_k
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
TopK
>
(
std
::
shared_ptr
<
ngraph
::
Node
>
top_k
=
std
::
make_shared
<
default_opset
::
TopK
>
(
data
,
k
,
axis
,
ngraph
::
op
::
v1
::
TopK
::
Mode
::
MAX
,
ngraph
::
op
::
v1
::
TopK
::
SortType
::
SORT_VALUES
,
default_opset
::
TopK
::
Mode
::
MAX
,
default_opset
::
TopK
::
SortType
::
SORT_VALUES
,
element
::
i64
);
return
get_outputs
(
top_k
);
...
...
@@ -123,14 +124,14 @@ namespace ngraph
const
auto
sorted
=
node
.
get_attribute_value
<
std
::
int64_t
>
(
"sorted"
,
1
);
// Map attribute values to nGraph enums
const
auto
sort_type
=
sorted
?
ngraph
::
op
::
v1
::
TopK
::
SortType
::
SORT_VALUES
:
ngraph
::
op
::
v1
::
TopK
::
SortType
::
NONE
;
const
auto
sort_type
=
sorted
?
default_opset
::
TopK
::
SortType
::
SORT_VALUES
:
default_opset
::
TopK
::
SortType
::
NONE
;
const
auto
compute_max
=
static_cast
<
bool
>
(
largest
);
const
auto
mode
=
compute_max
?
ngraph
::
op
::
v1
::
TopK
::
Mode
::
MAX
:
ngraph
::
op
::
v1
::
TopK
::
Mode
::
MIN
;
const
auto
mode
=
compute_max
?
default_opset
::
TopK
::
Mode
::
MAX
:
default_opset
::
TopK
::
Mode
::
MIN
;
std
::
shared_ptr
<
ngraph
::
Node
>
top_k
=
std
::
make_shared
<
ngraph
::
op
::
v1
::
TopK
>
(
std
::
shared_ptr
<
ngraph
::
Node
>
top_k
=
std
::
make_shared
<
default_opset
::
TopK
>
(
data
,
k
,
axis
,
mode
,
sort_type
,
element
::
i64
);
return
get_outputs
(
top_k
);
...
...
src/ngraph/frontend/onnx_import/op/unsqueeze.cpp
View file @
d33698fa
...
...
@@ -16,8 +16,7 @@
#include <memory>
#include "ngraph/op/constant.hpp"
#include "ngraph/op/fused/unsqueeze.hpp"
#include "default_opset.hpp"
#include "ngraph/shape.hpp"
#include "unsqueeze.hpp"
#include "utils/common.hpp"
...
...
@@ -37,9 +36,9 @@ namespace ngraph
const
auto
expanded_rank
=
data
->
get_shape
().
size
()
+
axes
.
size
();
std
::
vector
<
std
::
size_t
>
valid_axes
=
common
::
validate_axes
(
node
,
axes
,
expanded_rank
);
auto
axes_node
=
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
auto
axes_node
=
std
::
make_shared
<
default_opset
::
Constant
>
(
element
::
i64
,
Shape
{
valid_axes
.
size
()},
valid_axes
);
return
{
std
::
make_shared
<
ngraph
::
op
::
Unsqueeze
>
(
data
,
axes_node
)};
return
{
std
::
make_shared
<
default_opset
::
Unsqueeze
>
(
data
,
axes_node
)};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/where.hpp
View file @
d33698fa
...
...
@@ -20,8 +20,8 @@
#include "core/node.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/select.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace
ngraph
{
...
...
@@ -35,7 +35,7 @@ namespace ngraph
{
NodeVector
ng_inputs
{
ngraph
::
op
::
numpy_style_broadcast
(
node
.
get_ng_inputs
())};
return
{
std
::
make_shared
<
ngraph
::
op
::
Select
>
(
return
{
std
::
make_shared
<
ngraph
::
op
set0
::
Select
>
(
ng_inputs
.
at
(
0
),
ng_inputs
.
at
(
1
),
ng_inputs
.
at
(
2
))};
}
}
// namespace set_1
...
...
src/ngraph/frontend/onnx_import/op/xor.hpp
View file @
d33698fa
...
...
@@ -17,9 +17,9 @@
#pragma once
#include "core/node.hpp"
#include "default_opset.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/op/xor.hpp"
namespace
ngraph
{
...
...
@@ -31,7 +31,7 @@ namespace ngraph
{
inline
NodeVector
logical_xor
(
const
Node
&
node
)
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
LogicalXor
>
(
return
{
std
::
make_shared
<
default_opset
::
LogicalXor
>
(
node
.
get_ng_inputs
().
at
(
0
),
node
.
get_ng_inputs
().
at
(
1
),
ngraph
::
op
::
AutoBroadcastSpec
(
ngraph
::
op
::
AutoBroadcastType
::
NUMPY
))};
...
...
src/ngraph/frontend/onnx_import/utils/common.cpp
View file @
d33698fa
...
...
@@ -16,7 +16,9 @@
#include <onnx/onnx_pb.h> // onnx types
#include "common.hpp"
#include "default_opset.hpp"
#include "ngraph/op/get_output_element.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "validation_util.hpp"
namespace
ngraph
...
...
@@ -92,7 +94,7 @@ namespace ngraph
}
else
{
outputs
[
i
]
=
std
::
make_shared
<
ngraph
::
op
::
GetOutputElement
>
(
node
,
i
);
outputs
[
i
]
=
std
::
make_shared
<
ngraph
::
op
set0
::
GetOutputElement
>
(
node
,
i
);
}
}
return
outputs
;
...
...
src/ngraph/frontend/onnx_import/utils/common.hpp
View file @
d33698fa
...
...
@@ -26,7 +26,7 @@
#include <vector>
#include "core/node.hpp"
#include "
ngraph/op/constan
t.hpp"
#include "
default_opse
t.hpp"
#include "ngraph/op/util/broadcasting.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type.hpp"
...
...
@@ -155,7 +155,7 @@ namespace ngraph
identity_matrix
.
at
(
diagonal_element_idx
)
=
T
{
1
};
}
return
std
::
make_shared
<
ngraph
::
op
::
Constant
>
(
return
std
::
make_shared
<
default_opset
::
Constant
>
(
output_type
,
output_shape
,
identity_matrix
);
}
...
...
@@ -165,7 +165,7 @@ namespace ngraph
///
/// \return A Constant node representing identity matrix with shape (n, n).
template
<
typename
T
=
double
>
std
::
shared_ptr
<
ngraph
::
op
::
Constant
>
square_identity
(
const
size_t
n
,
std
::
shared_ptr
<
default_opset
::
Constant
>
square_identity
(
const
size_t
n
,
const
element
::
Type
&
type
)
{
return
shifted_square_identity
(
Shape
{
n
,
n
},
type
,
0
);
...
...
src/ngraph/frontend/onnx_import/utils/pooling_factory.cpp
View file @
d33698fa
...
...
@@ -16,6 +16,7 @@
#include <iterator>
#include "default_opset.hpp"
#include "ngraph/coordinate_diff.hpp"
#include "utils/convpool.hpp"
#include "utils/pooling_factory.hpp"
...
...
@@ -45,7 +46,7 @@ namespace ngraph
{
bool
count_include_pad
=
m_onnx_node
.
get_attribute_value
<
std
::
int64_t
>
(
"count_include_pad"
,
0
);
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
AvgPool
>
(
m_inputs
.
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
AvgPool
>
(
m_inputs
.
at
(
0
),
m_strides
,
m_padding_below
,
m_padding_above
,
...
...
@@ -57,7 +58,7 @@ namespace ngraph
NodeVector
PoolingFactory
::
make_max_pool
()
const
{
return
{
std
::
make_shared
<
ngraph
::
op
::
v1
::
MaxPool
>
(
m_inputs
.
at
(
0
),
return
{
std
::
make_shared
<
default_opset
::
MaxPool
>
(
m_inputs
.
at
(
0
),
m_strides
,
m_padding_below
,
m_padding_above
,
...
...
src/ngraph/opsets/opset0.hpp
0 → 100644
View file @
d33698fa
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#pragma once
#include "ngraph/ops.hpp"
namespace
ngraph
{
namespace
opset0
{
#define NGRAPH_OP(a, b) using b::a;
#include "ngraph/opsets/opset0_tbl.hpp"
#undef NGRAPH_OP
}
}
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