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
db6038e3
"...git@developer.sourcefind.cn:lacacy/qwen_lmdeploy.git" did not exist on "d592fbea9f1fd3ed15b6d7836d217ecfb5711b5a"
Commit
db6038e3
authored
Nov 14, 2018
by
Khalique
Browse files
add identity onnx parsing
parent
80203608
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+1
-0
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+14
-0
No files found.
src/onnx/onnx.cpp
View file @
db6038e3
...
...
@@ -53,6 +53,7 @@ struct onnx_parser
add_generic_op
(
"Relu"
,
op
::
relu
{});
// disable dropout for inference
add_generic_op
(
"Dropout"
,
op
::
identity
{});
add_generic_op
(
"Identity"
,
op
::
identity
{});
add_broadcastable_binary_op
(
"Add"
,
op
::
add
{});
add_broadcastable_binary_op
(
"Div"
,
op
::
div
{});
...
...
test/cpu_ops_test.cpp
View file @
db6038e3
...
...
@@ -1091,4 +1091,18 @@ TEST_CASE(contiguous_test)
EXPECT
(
migraph
::
verify_range
(
results_vector
,
gold
));
}
TEST_CASE
(
identity_test
)
{
migraph
::
program
p
;
migraph
::
shape
s
{
migraph
::
shape
::
float_type
,
{
2
,
2
}};
std
::
vector
<
int
>
data
{
1
,
2
,
3
,
4
};
auto
l
=
p
.
add_literal
(
migraph
::
literal
{
s
,
data
});
p
.
add_instruction
(
migraph
::
op
::
identity
{},
l
);
p
.
compile
(
migraph
::
cpu
::
target
{});
auto
result
=
p
.
eval
({});
std
::
vector
<
int
>
results_vector
(
4
);
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
EXPECT
(
std
::
equal
(
data
.
begin
(),
data
.
end
(),
results_vector
.
begin
()));
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
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