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
34c61ed3
Commit
34c61ed3
authored
May 09, 2019
by
Khalique
Browse files
add relu6 op and tests
parent
767ca0cc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
src/tf/tf.cpp
src/tf/tf.cpp
+10
-0
test/tf/relu6_test.pb
test/tf/relu6_test.pb
+8
-0
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+10
-0
No files found.
src/tf/tf.cpp
View file @
34c61ed3
...
@@ -123,6 +123,7 @@ struct tf_parser
...
@@ -123,6 +123,7 @@ struct tf_parser
add_mem_op
(
"Mean"
,
&
tf_parser
::
parse_mean
);
add_mem_op
(
"Mean"
,
&
tf_parser
::
parse_mean
);
add_mem_op
(
"Pack"
,
&
tf_parser
::
parse_pack
);
add_mem_op
(
"Pack"
,
&
tf_parser
::
parse_pack
);
add_mem_op
(
"Pad"
,
&
tf_parser
::
parse_pad
);
add_mem_op
(
"Pad"
,
&
tf_parser
::
parse_pad
);
add_mem_op
(
"Relu6"
,
&
tf_parser
::
parse_relu6
);
add_mem_op
(
"Reshape"
,
&
tf_parser
::
parse_reshape
);
add_mem_op
(
"Reshape"
,
&
tf_parser
::
parse_reshape
);
add_mem_op
(
"Softmax"
,
&
tf_parser
::
parse_softmax
);
add_mem_op
(
"Softmax"
,
&
tf_parser
::
parse_softmax
);
add_mem_op
(
"Squeeze"
,
&
tf_parser
::
parse_squeeze
);
add_mem_op
(
"Squeeze"
,
&
tf_parser
::
parse_squeeze
);
...
@@ -482,6 +483,15 @@ struct tf_parser
...
@@ -482,6 +483,15 @@ struct tf_parser
return
prog
.
add_instruction
(
op
,
args
[
0
]);
return
prog
.
add_instruction
(
op
,
args
[
0
]);
}
}
instruction_ref
parse_relu6
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
op
::
clip
op
;
op
.
max_val
=
6.0
;
op
.
min_val
=
0.0
;
return
prog
.
add_instruction
(
op
,
std
::
move
(
args
));
}
instruction_ref
instruction_ref
parse_reshape
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
parse_reshape
(
const
std
::
string
&
,
const
attribute_map
&
,
std
::
vector
<
instruction_ref
>
args
)
{
{
...
...
test/tf/relu6_test.pb
0 → 100644
View file @
34c61ed3
:
0Placeholder*
dtype0*
shape:
relu6Relu60*
T0"
\ No newline at end of file
test/tf/tf_test.cpp
View file @
34c61ed3
...
@@ -229,6 +229,16 @@ TEST_CASE(relu_test)
...
@@ -229,6 +229,16 @@ TEST_CASE(relu_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
relu6_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
::
clip
{
6.0
,
0.0
},
l0
);
auto
prog
=
migraphx
::
parse_tf
(
"relu6_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
reshape_test
)
TEST_CASE
(
reshape_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