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
5d116018
Commit
5d116018
authored
Dec 12, 2019
by
Tomasz Socha
Committed by
Scott Cyphers
Dec 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use v1::Gather in ONNX Importer (#4037)
parent
8bd37070
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
gather.hpp
src/ngraph/frontend/onnx_import/op/gather.hpp
+5
-2
opset0_downgrade.cpp
src/ngraph/pass/opset0_downgrade.cpp
+22
-1
No files found.
src/ngraph/frontend/onnx_import/op/gather.hpp
View file @
5d116018
...
...
@@ -20,7 +20,7 @@
#include "core/node.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op
/gather
.hpp"
#include "ngraph/op
sets/opset1
.hpp"
#include "utils/common.hpp"
namespace
ngraph
...
...
@@ -39,7 +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
<
ngraph
::
op
::
Gather
>
(
data
,
indices
,
valid_axis
)};
return
{
std
::
make_shared
<
opset1
::
Gather
>
(
data
,
indices
,
opset1
::
Constant
::
create
(
element
::
i64
,
Shape
{},
{
valid_axis
}))};
}
}
// namespace set_1
...
...
src/ngraph/pass/opset0_downgrade.cpp
View file @
5d116018
...
...
@@ -231,6 +231,27 @@ namespace
return
true
;
}
bool
op_cast
(
shared_ptr
<
op
::
v1
::
Gather
>
node
)
{
auto
axis_node
=
as_type_ptr
<
op
::
Constant
>
(
node
->
input_value
(
2
).
get_node_shared_ptr
());
NGRAPH_CHECK
(
axis_node
,
"Unable to convert Gather:v1 to Gather:v0 if axis is not constant. Node: "
,
*
node
);
NGRAPH_CHECK
(
axis_node
->
get_element_type
()
==
element
::
i64
,
"Unable to convert Gather:v1 to Gather:v0 with axis other type than int64. Node: "
,
*
node
);
int64_t
axis
=
axis_node
->
get_vector
<
int64_t
>
()[
0
];
auto
replacement_node
=
make_shared
<
op
::
v0
::
Gather
>
(
node
->
input_value
(
0
),
node
->
input_value
(
1
),
axis
);
replace_node
(
node
,
replacement_node
);
return
true
;
}
bool
op_cast
(
shared_ptr
<
op
::
v1
::
GenerateMask
>
node
)
{
NGRAPH_CHECK
(
node
->
input_value
(
1
).
get_node_shared_ptr
()
->
is_constant
());
...
...
@@ -707,7 +728,7 @@ namespace
};
return
dispatch_map
;
}
}
}
// namespace
bool
pass
::
Opset0Downgrade
::
run_on_node
(
shared_ptr
<
Node
>
node
)
{
...
...
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