Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
15f756dd
Commit
15f756dd
authored
Apr 09, 2019
by
Khalique
Browse files
added tests for mul and matmul
parent
3ca8879d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
0 deletions
+56
-0
src/tf/tf.cpp
src/tf/tf.cpp
+1
-0
test/tf/matmul_test.pb
test/tf/matmul_test.pb
+16
-0
test/tf/mul_test.pb
test/tf/mul_test.pb
+12
-0
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+27
-0
No files found.
src/tf/tf.cpp
View file @
15f756dd
...
...
@@ -110,6 +110,7 @@ struct tf_parser
add_generic_op
(
"Relu"
,
op
::
relu
{});
add_binary_op
(
"Add"
,
op
::
add
{});
add_binary_op
(
"Mul"
,
op
::
mul
{});
add_mem_op
(
"AvgPool"
,
&
tf_parser
::
parse_pooling
);
add_mem_op
(
"BiasAdd"
,
&
tf_parser
::
parse_biasadd
);
...
...
test/tf/matmul_test.pb
0 → 100644
View file @
15f756dd
2
0Placeholder*
dtype0*
shape
:
2
1Placeholder*
dtype0*
shape
:
F
matmul1MatMul01*
T0*
transpose_a(*
transpose_b("
\ No newline at end of file
test/tf/mul_test.pb
0 → 100644
View file @
15f756dd
:
0Placeholder*
shape:*
dtype0
:
1Placeholder*
dtype0*
shape:
mul1Mul01*
T0"
\ No newline at end of file
test/tf/tf_test.cpp
View file @
15f756dd
...
...
@@ -129,6 +129,33 @@ TEST_CASE(identity_test)
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
matmul_test
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
8
,
4
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
}});
auto
trans_l0
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l0
);
auto
trans_l1
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{},
trans_l0
,
trans_l1
);
auto
prog
=
migraphx
::
parse_tf
(
"matmul_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
mul_test
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
1
,
16
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
1
,
16
}});
p
.
add_instruction
(
migraphx
::
op
::
mul
{},
l0
,
l1
);
auto
prog
=
migraphx
::
parse_tf
(
"mul_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
pack_test
)
{
migraphx
::
program
p
;
...
...
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