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
e6dad531
Commit
e6dad531
authored
Aug 31, 2018
by
tsocha
Committed by
Scott Cyphers
Aug 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ONNX] Concat operator (#1524)
* [ONNX] Concat operator * Style fix
parent
9779dc81
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
0 deletions
+93
-0
CMakeLists.txt
src/ngraph/frontend/onnx_import/CMakeLists.txt
+2
-0
concat.cpp
src/ngraph/frontend/onnx_import/op/concat.cpp
+39
-0
concat.hpp
src/ngraph/frontend/onnx_import/op/concat.hpp
+34
-0
ops_bridge.cpp
src/ngraph/frontend/onnx_import/ops_bridge.cpp
+2
-0
concat.onnx
test/models/onnx/concat.onnx
+0
-0
onnx_import.cpp
test/onnx_import.cpp
+16
-0
No files found.
src/ngraph/frontend/onnx_import/CMakeLists.txt
View file @
e6dad531
...
...
@@ -36,6 +36,8 @@ add_library(onnx_import STATIC
op/average_pool.hpp
op/batch_norm.cpp
op/batch_norm.hpp
op/concat.cpp
op/concat.hpp
op/constant.cpp
op/constant.hpp
op/conv.cpp
...
...
src/ngraph/frontend/onnx_import/op/concat.cpp
0 → 100644
View file @
e6dad531
//*****************************************************************************
// Copyright 2018 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 "concat.hpp"
#include "ngraph/op/concat.hpp"
namespace
ngraph
{
namespace
onnx_import
{
namespace
op
{
NodeVector
concat
(
const
Node
&
node
)
{
NodeVector
inputs
{
node
.
get_ng_inputs
()};
auto
axis
=
node
.
get_attribute_value
<
int64_t
>
(
"axis"
);
return
{
std
::
make_shared
<
ngraph
::
op
::
Concat
>
(
inputs
,
axis
)};
}
}
// namespace op
}
// namespace onnx_import
}
// namespace ngraph
src/ngraph/frontend/onnx_import/op/concat.hpp
0 → 100644
View file @
e6dad531
//*****************************************************************************
// Copyright 2018 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/node_vector.hpp"
#include "core/node.hpp"
namespace
ngraph
{
namespace
onnx_import
{
namespace
op
{
NodeVector
concat
(
const
Node
&
node
);
}
// namespace op
}
// namespace onnx_import
}
// namespace ngraph
src/ngraph/frontend/onnx_import/ops_bridge.cpp
View file @
e6dad531
...
...
@@ -21,6 +21,7 @@
#include "op/add.hpp"
#include "op/average_pool.hpp"
#include "op/batch_norm.hpp"
#include "op/concat.hpp"
#include "op/constant.hpp"
#include "op/conv.hpp"
#include "op/div.hpp"
...
...
@@ -86,6 +87,7 @@ namespace ngraph
std
::
bind
(
op
::
average_pool
,
std
::
placeholders
::
_1
));
m_map
.
emplace
(
"BatchNormalization"
,
std
::
bind
(
op
::
batch_norm
,
std
::
placeholders
::
_1
));
m_map
.
emplace
(
"Concat"
,
std
::
bind
(
op
::
concat
,
std
::
placeholders
::
_1
));
m_map
.
emplace
(
"Constant"
,
std
::
bind
(
op
::
constant
,
std
::
placeholders
::
_1
));
m_map
.
emplace
(
"Conv"
,
std
::
bind
(
op
::
conv
,
std
::
placeholders
::
_1
));
m_map
.
emplace
(
"Div"
,
std
::
bind
(
op
::
div
,
std
::
placeholders
::
_1
));
...
...
test/models/onnx/concat.onnx
0 → 100644
View file @
e6dad531
File added
test/onnx_import.cpp
View file @
e6dad531
...
...
@@ -488,6 +488,22 @@ TEST(onnx, model_softmax)
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
,
result_vectors
.
front
()));
}
TEST
(
onnx
,
model_concat
)
{
auto
function
=
onnx_import
::
import_onnx_function
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/concat.onnx"
));
Inputs
inputs
;
inputs
.
emplace_back
(
test
::
NDArray
<
float
,
1
>
({
1
,
2
}).
get_vector
());
inputs
.
emplace_back
(
test
::
NDArray
<
float
,
1
>
({
3
,
4
}).
get_vector
());
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
1
>
({
1
,
2
,
3
,
4
}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"INTERPRETER"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_flatten
)
{
auto
function
=
onnx_import
::
import_onnx_function
(
...
...
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