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
508333b6
Unverified
Commit
508333b6
authored
Jul 19, 2019
by
mvermeulen
Committed by
GitHub
Jul 19, 2019
Browse files
Merge branch 'develop' into cast_op
parents
2d743851
40b0c973
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
src/tf/tf.cpp
src/tf/tf.cpp
+10
-0
test/tf/batchmatmul_test.pb
test/tf/batchmatmul_test.pb
+14
-0
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+15
-0
No files found.
src/tf/tf.cpp
View file @
508333b6
...
@@ -164,6 +164,7 @@ struct tf_parser
...
@@ -164,6 +164,7 @@ struct tf_parser
add_binary_op
(
"Sub"
,
op
::
sub
{});
add_binary_op
(
"Sub"
,
op
::
sub
{});
add_mem_op
(
"AvgPool"
,
&
tf_parser
::
parse_pooling
);
add_mem_op
(
"AvgPool"
,
&
tf_parser
::
parse_pooling
);
add_mem_op
(
"BatchMatMul"
,
&
tf_parser
::
parse_matmul
,
false
);
add_mem_op
(
"BiasAdd"
,
&
tf_parser
::
parse_biasadd
);
add_mem_op
(
"BiasAdd"
,
&
tf_parser
::
parse_biasadd
);
add_mem_op
(
"Cast"
,
&
tf_parser
::
parse_cast
,
false
);
add_mem_op
(
"Cast"
,
&
tf_parser
::
parse_cast
,
false
);
add_mem_op
(
"ConcatV2"
,
&
tf_parser
::
parse_concat
,
false
);
add_mem_op
(
"ConcatV2"
,
&
tf_parser
::
parse_concat
,
false
);
...
@@ -538,6 +539,15 @@ struct tf_parser
...
@@ -538,6 +539,15 @@ struct tf_parser
transb
=
attributes
.
at
(
"transpose_a"
).
b
();
transb
=
attributes
.
at
(
"transpose_a"
).
b
();
}
}
if
(
contains
(
attributes
,
"adj_x"
))
{
transa
=
attributes
.
at
(
"adj_x"
).
b
();
}
if
(
contains
(
attributes
,
"adj_y"
))
{
transb
=
attributes
.
at
(
"adj_y"
).
b
();
}
std
::
vector
<
int64_t
>
perm
(
args
[
0
]
->
get_shape
().
lens
().
size
());
std
::
vector
<
int64_t
>
perm
(
args
[
0
]
->
get_shape
().
lens
().
size
());
std
::
iota
(
perm
.
begin
(),
perm
.
end
(),
int64_t
{
0
});
std
::
iota
(
perm
.
begin
(),
perm
.
end
(),
int64_t
{
0
});
// swap the last two elements
// swap the last two elements
...
...
test/tf/batchmatmul_test.pb
0 → 100644
View file @
508333b6
:
0Placeholder*
shape:*
dtype0
:
1Placeholder*
dtype0*
shape:
D
batchmatmul1BatchMatMul01*
adj_x(*
adj_y(*
T0"
\ No newline at end of file
test/tf/tf_test.cpp
View file @
508333b6
...
@@ -48,6 +48,21 @@ TEST_CASE(add_bcast_test)
...
@@ -48,6 +48,21 @@ TEST_CASE(add_bcast_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
batchmatmul_test
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
8
,
4
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
,
8
}});
auto
trans_l0
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
1
,
3
,
2
}},
l0
);
auto
trans_l1
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
1
,
3
,
2
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{},
trans_l0
,
trans_l1
);
auto
prog
=
optimize_tf
(
"batchmatmul_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
batchnorm_test
)
TEST_CASE
(
batchnorm_test
)
{
{
float
epsilon
=
1.001e-5
f
;
float
epsilon
=
1.001e-5
f
;
...
...
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