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
acadd646
Unverified
Commit
acadd646
authored
Oct 23, 2018
by
Scott Thornton
Committed by
GitHub
Oct 23, 2018
Browse files
Merge pull request #93 from ROCmSoftwarePlatform/onnx_parsing_squeeze_slice_concat
Onnx parsing squeeze slice concat
parents
ad414ba9
1a0abc65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+50
-0
No files found.
src/onnx/onnx.cpp
View file @
acadd646
...
...
@@ -66,6 +66,10 @@ struct onnx_parser
add_mem_op
(
"Gemm"
,
&
onnx_parser
::
parse_gemm
);
add_mem_op
(
"BatchNormalization"
,
&
onnx_parser
::
parse_batchnorm
);
add_mem_op
(
"Softmax"
,
&
onnx_parser
::
parse_softmax
);
add_mem_op
(
"Squeeze"
,
&
onnx_parser
::
parse_squeeze
);
add_mem_op
(
"Unsqueeze"
,
&
onnx_parser
::
parse_unsqueeze
);
add_mem_op
(
"Slice"
,
&
onnx_parser
::
parse_slice
);
add_mem_op
(
"Concat"
,
&
onnx_parser
::
parse_concat
);
}
template
<
class
F
>
...
...
@@ -187,6 +191,52 @@ struct onnx_parser
return
prog
.
add_instruction
(
op
::
flatten
{
axis
},
args
[
0
]);
}
instruction_ref
parse_squeeze
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
op
::
squeeze
op
;
literal
s
=
parse_value
(
attributes
.
at
(
"axes"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
axes
));
});
return
prog
.
add_instruction
(
op
,
args
[
0
]);
}
instruction_ref
parse_unsqueeze
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
op
::
unsqueeze
op
;
literal
s
=
parse_value
(
attributes
.
at
(
"axes"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
axes
));
});
return
prog
.
add_instruction
(
op
,
args
[
0
]);
}
instruction_ref
parse_concat
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
std
::
size_t
axis
=
parse_value
(
attributes
.
at
(
"axis"
)).
at
<
int
>
();
op
::
concat
op
{
axis
};
return
prog
.
add_instruction
(
op
,
std
::
move
(
args
));
}
instruction_ref
parse_slice
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
op
::
slice
op
;
if
(
contains
(
attributes
,
"axes"
))
{
literal
s
=
parse_value
(
attributes
.
at
(
"axes"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
axes
));
});
}
{
literal
s
=
parse_value
(
attributes
.
at
(
"ends"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
ends
));
});
}
{
literal
s
=
parse_value
(
attributes
.
at
(
"starts"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
starts
));
});
}
return
prog
.
add_instruction
(
op
,
args
[
0
]);
}
instruction_ref
parse_constant
(
const
std
::
string
&
,
attribute_map
attributes
,
const
std
::
vector
<
instruction_ref
>&
)
...
...
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