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
e435153e
Commit
e435153e
authored
Oct 31, 2022
by
charlie
Browse files
Add shape unit tests for added methods
parent
d5b1b6c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
test/shape_test.cpp
test/shape_test.cpp
+39
-0
No files found.
test/shape_test.cpp
View file @
e435153e
...
...
@@ -185,6 +185,30 @@ TEST_CASE(test_shape_packed)
EXPECT
(
not
s
.
broadcasted
());
}
TEST_CASE
(
test_shape_ndim_static
)
{
migraphx
::
shape
s0
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}};
EXPECT
(
s0
.
ndim
()
==
2
);
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
,
4
}};
EXPECT
(
s1
.
ndim
()
==
4
);
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{
2
,
4
,
4
,
1
,
3
}};
EXPECT
(
s1
.
ndim
()
==
5
);
}
TEST_CASE
(
test_shape_ndim_dyn
)
{
migraphx
::
shape
s0
{
migraphx
::
shape
::
float_type
,
{{
2
,
2
,
0
},
{
2
,
2
,
0
}}};
EXPECT
(
s0
.
ndim
()
==
2
);
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
}}};
EXPECT
(
s1
.
ndim
()
==
4
);
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
},
{
1
,
1
,
1
},
{
3
,
3
,
0
}}};
EXPECT
(
s1
.
ndim
()
==
5
);
}
TEST_CASE
(
test_shape_non_packed_single_dim
)
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
1
,
64
,
35
,
35
},
{
156800
,
1225
,
35
,
1
}};
...
...
@@ -212,6 +236,21 @@ TEST_CASE(test_shape_transposed2)
EXPECT
(
not
s
.
broadcasted
());
}
TEST_CASE
(
test_shape_static_to_dynamic
)
{
migraphx
::
shape
s0
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
,
4
}};
migraphx
::
shape
s1
=
s0
.
to_dynamic
();
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
,
0
},
{
2
,
2
,
0
},
{
4
,
4
,
0
},
{
4
,
4
,
0
}}};
EXPECT
(
s1
==
s2
);
}
TEST_CASE
(
test_shape_dyn_to_dynamic
)
{
migraphx
::
shape
s0
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
},
{
2
,
4
,
0
}}};
migraphx
::
shape
s1
=
s0
.
to_dynamic
();
EXPECT
(
s0
==
s1
);
}
TEST_CASE
(
test_shape_overlap
)
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
3
},
{
6
,
3
,
2
}};
...
...
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