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
5944d0c7
Unverified
Commit
5944d0c7
authored
Jul 22, 2019
by
mvermeulen
Committed by
GitHub
Jul 22, 2019
Browse files
Merge pull request #321 from ROCmSoftwarePlatform/cast_op
Cast op
parents
dcbc9255
d6bc77c4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
src/tf/tf.cpp
src/tf/tf.cpp
+8
-0
test/tf/cast_test.pb
test/tf/cast_test.pb
+0
-0
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+10
-0
No files found.
src/tf/tf.cpp
View file @
5944d0c7
...
@@ -166,6 +166,7 @@ struct tf_parser
...
@@ -166,6 +166,7 @@ struct tf_parser
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
(
"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
(
"ConcatV2"
,
&
tf_parser
::
parse_concat
,
false
);
add_mem_op
(
"ConcatV2"
,
&
tf_parser
::
parse_concat
,
false
);
add_mem_op
(
"Const"
,
&
tf_parser
::
parse_constant
);
add_mem_op
(
"Const"
,
&
tf_parser
::
parse_constant
);
add_mem_op
(
"Conv2D"
,
&
tf_parser
::
parse_conv
);
add_mem_op
(
"Conv2D"
,
&
tf_parser
::
parse_conv
);
...
@@ -307,6 +308,13 @@ struct tf_parser
...
@@ -307,6 +308,13 @@ struct tf_parser
return
prog
.
add_instruction
(
op
::
add
{},
args
[
0
],
l0
);
return
prog
.
add_instruction
(
op
::
add
{},
args
[
0
],
l0
);
}
}
instruction_ref
parse_cast
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
shape
::
type_t
type
=
parse_type
(
attributes
.
at
(
"DstT"
).
type
());
return
prog
.
add_instruction
(
op
::
convert
{
type
},
std
::
move
(
args
));
}
instruction_ref
instruction_ref
parse_concat
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
parse_concat
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
{
...
...
test/tf/cast_test.pb
0 → 100644
View file @
5944d0c7
File added
test/tf/tf_test.cpp
View file @
5944d0c7
...
@@ -118,6 +118,16 @@ TEST_CASE(concat_test)
...
@@ -118,6 +118,16 @@ TEST_CASE(concat_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
cast_test
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
16
,
16
}});
p
.
add_instruction
(
migraphx
::
op
::
convert
{
migraphx
::
shape
::
int32_type
},
l0
);
auto
prog
=
optimize_tf
(
"cast_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
const_test
)
TEST_CASE
(
const_test
)
{
{
migraphx
::
program
p
;
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