Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
11318d9c
Unverified
Commit
11318d9c
authored
Aug 14, 2018
by
Paul Fultz II
Committed by
GitHub
Aug 14, 2018
Browse files
Merge pull request #34 from ROCmSoftwarePlatform/onnx_initializer
Added reading from initializer in ONNX
parents
f8641929
b6fe849a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+17
-3
No files found.
src/onnx/onnx.cpp
View file @
11318d9c
...
...
@@ -216,12 +216,26 @@ struct onnx_parser
void
parse_graph
(
const
onnx
::
GraphProto
&
graph
)
{
nodes
=
get_nodes
(
graph
);
std
::
unordered_map
<
std
::
string
,
onnx
::
TensorProto
>
initializer_data
;
for
(
auto
&&
f
:
graph
.
initializer
())
{
initializer_data
[
f
.
name
()]
=
f
;
}
for
(
auto
&&
input
:
graph
.
input
())
{
const
std
::
string
&
name
=
input
.
name
();
// TODO: Get shape of input parameter
shape
s
=
parse_type
(
input
.
type
());
instructions
[
name
]
=
prog
.
add_parameter
(
name
,
s
);
// Does the input have an initializer?
if
(
contains
(
initializer_data
,
name
))
{
auto
t
=
initializer_data
[
name
];
instructions
[
name
]
=
prog
.
add_literal
(
parse_tensor
(
t
));
}
else
{
// TODO: Get shape of input parameter
shape
s
=
parse_type
(
input
.
type
());
instructions
[
name
]
=
prog
.
add_parameter
(
name
,
s
);
}
}
for
(
auto
&&
p
:
nodes
)
{
...
...
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