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
e1bc4b99
Unverified
Commit
e1bc4b99
authored
Nov 16, 2018
by
Paul Fultz II
Committed by
GitHub
Nov 16, 2018
Browse files
Merge pull request #117 from ROCmSoftwarePlatform/identity
Identity
parents
f04a3ba6
05a0e86e
Changes
2
Show 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 @
e1bc4b99
...
@@ -53,6 +53,7 @@ struct onnx_parser
...
@@ -53,6 +53,7 @@ struct onnx_parser
add_generic_op
(
"Relu"
,
op
::
relu
{});
add_generic_op
(
"Relu"
,
op
::
relu
{});
// disable dropout for inference
// disable dropout for inference
add_generic_op
(
"Dropout"
,
op
::
identity
{});
add_generic_op
(
"Dropout"
,
op
::
identity
{});
add_generic_op
(
"Identity"
,
op
::
identity
{});
add_broadcastable_binary_op
(
"Add"
,
op
::
add
{});
add_broadcastable_binary_op
(
"Add"
,
op
::
add
{});
add_broadcastable_binary_op
(
"Div"
,
op
::
div
{});
add_broadcastable_binary_op
(
"Div"
,
op
::
div
{});
...
...
test/cpu_ops_test.cpp
View file @
e1bc4b99
...
@@ -1091,4 +1091,18 @@ TEST_CASE(contiguous_test)
...
@@ -1091,4 +1091,18 @@ TEST_CASE(contiguous_test)
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
gold
));
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
gold
));
}
}
TEST_CASE
(
identity_test
)
{
migraphx
::
program
p
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}};
std
::
vector
<
int
>
data
{
1
,
2
,
3
,
4
};
auto
l
=
p
.
add_literal
(
migraphx
::
literal
{
s
,
data
});
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
l
);
p
.
compile
(
migraphx
::
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
);
}
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