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
6dfc8696
Commit
6dfc8696
authored
Feb 02, 2019
by
Khalique
Browse files
added initial testing program with pb file
parent
ca4eb13d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
+45
-3
src/tf/tf.cpp
src/tf/tf.cpp
+8
-3
test/CMakeLists.txt
test/CMakeLists.txt
+9
-0
test/tf/relu_test.pb
test/tf/relu_test.pb
+8
-0
test/tf/tf_test.cpp
test/tf/tf_test.cpp
+20
-0
No files found.
src/tf/tf.cpp
View file @
6dfc8696
...
...
@@ -52,7 +52,7 @@ struct tf_parser
add_generic_op
(
"Identity"
,
op
::
identity
{});
add_generic_op
(
"Relu"
,
op
::
relu
{});
//
add_binary_op("
Bias
Add", op::add{});
add_binary_op
(
"Add"
,
op
::
add
{});
add_mem_op
(
"AvgPool"
,
&
tf_parser
::
parse_pooling
);
add_mem_op
(
"BiasAdd"
,
&
tf_parser
::
parse_biasadd
);
...
...
@@ -337,8 +337,13 @@ struct tf_parser
op
.
lengths
[
1
]
=
ksize
[
3
];
}
}
return
prog
.
add_instruction
(
op
,
std
::
move
(
args
));
auto
l0
=
args
[
0
];
if
(
l0
->
name
()
==
"@param"
)
{
if
(
is_nhwc
)
l0
=
prog
.
add_instruction
(
op
::
transpose
{{
0
,
3
,
1
,
2
}},
l0
);
}
return
prog
.
add_instruction
(
op
,
l0
);
}
instruction_ref
...
...
test/CMakeLists.txt
View file @
6dfc8696
...
...
@@ -120,6 +120,15 @@ add_test(NAME test_onnx COMMAND $<TARGET_FILE:test_onnx> WORKING_DIRECTORY ${CMA
add_dependencies
(
tests test_onnx
)
add_dependencies
(
check test_onnx
)
# tf test
add_executable
(
test_tf tf/tf_test.cpp
)
rocm_clang_tidy_check
(
test_tf
)
target_link_libraries
(
test_tf migraphx_tf
)
target_include_directories
(
test_tf PUBLIC include
)
add_test
(
NAME test_tf COMMAND $<TARGET_FILE:test_tf> WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/tf
)
add_dependencies
(
tests test_tf
)
add_dependencies
(
check test_tf
)
function
(
test_header NAME HEADER
)
file
(
WRITE
${
CMAKE_CURRENT_BINARY_DIR
}
/header-main-include-
${
NAME
}
.cpp
...
...
test/tf/relu_test.pb
0 → 100644
View file @
6dfc8696
:
0Placeholder*
dtype0*
shape:
reluRelu0*
T0"
\ No newline at end of file
test/tf/tf_test.cpp
0 → 100644
View file @
6dfc8696
#include <iostream>
#include <vector>
#include <migraphx/literal.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/program.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/tf.hpp>
#include "test.hpp"
TEST_CASE
(
relu_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
::
relu
{},
l0
);
auto
prog
=
migraphx
::
parse_tf
(
"relu_test.pb"
,
false
);
EXPECT
(
p
==
prog
);
}
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