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
64217aaf
Commit
64217aaf
authored
Oct 28, 2022
by
charlie
Browse files
Add tests
parent
27b0820d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
test/op_shape_test.cpp
test/op_shape_test.cpp
+13
-0
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+19
-0
No files found.
test/op_shape_test.cpp
View file @
64217aaf
...
...
@@ -1958,6 +1958,19 @@ TEST_CASE(test_squeeze_all)
expect_shape
(
s2
,
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
0
}}}),
s1
);
}
TEST_CASE
(
test_squeeze_dyn
)
{
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
1
,
1
,
0
},
{
3
,
3
,
0
},
{
1
,
1
,
0
},
{
3
,
3
,
0
}}};
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
1
,
1
,
0
},
{
3
,
3
,
0
},
{
3
,
3
,
0
}}};
expect_shape
(
s2
,
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
3
}}}),
s1
);
migraphx
::
shape
s3
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
3
,
3
,
0
},
{
3
,
3
,
0
}}};
expect_shape
(
s3
,
migraphx
::
make_op
(
"squeeze"
),
s1
);
throws_shape
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
0
}}}),
s1
);
}
TEST_CASE
(
test_squeeze_transpose
)
{
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
1
},
{
4
,
1
,
4
}};
...
...
test/ref_ops_test.cpp
View file @
64217aaf
...
...
@@ -7085,6 +7085,25 @@ TEST_CASE(squeeze_test)
}
}
TEST_CASE(squeeze_dyn_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s1{migraphx::shape::float_type,
{{1, 4, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}}};
auto p0 = mm->add_parameter("x", s1);
mm->add_instruction(migraphx::make_op("squeeze", {{"axes", {1}}}), p0);
p.compile(migraphx::ref::target{});
std::vector<float> input_data(4 * 3 * 3);
migraphx::parameter_map params0;
migraphx::shape input_fixed_shape0{migraphx::shape::float_type, {4, 1, 3, 1, 3}};
params0["x"] = migraphx::argument(input_fixed_shape0, input_data.data());
auto result = p.eval(params0).back();
migraphx::shape s2{migraphx::shape::float_type, {4, 3, 1, 3}};
EXPECT(result.get_shape() == s2);
}
TEST_CASE(step_test)
{
{
...
...
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