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
14d40d9b
Commit
14d40d9b
authored
Nov 15, 2022
by
charlie
Browse files
Update ref_ops_test
parent
8bbec307
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
30 deletions
+2
-30
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+2
-30
No files found.
test/ref_ops_test.cpp
View file @
14d40d9b
...
@@ -925,32 +925,6 @@ TEST_CASE(contiguous_test)
...
@@ -925,32 +925,6 @@ TEST_CASE(contiguous_test)
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
data
));
EXPECT
(
migraphx
::
verify_range
(
results_vector
,
data
));
}
}
TEST_CASE(contiguous_param_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape a_shape{migraphx::shape::float_type, {1, 3, 2, 2}, {12, 1, 6, 3}};
auto a = mm->add_parameter("X", a_shape);
mm->add_instruction(migraphx::make_op("contiguous"), a);
p.compile(migraphx::ref::target{});
std::vector<float> data(12);
std::iota(data.begin(), data.end(), 0);
migraphx::parameter_map params;
params["X"] = migraphx::argument(a_shape, data.data());
auto result = p.eval(params).back();
result.visit([&](auto output) {
std::vector<size_t> new_strides = {12, 4, 2, 1};
EXPECT(bool{output.get_shape().strides() == new_strides});
});
std::vector<float> results_vector(12);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
std::vector<float> gold = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11};
EXPECT(migraphx::verify_range(results_vector, gold));
}
TEST_CASE
(
contiguous_dyn_test
)
TEST_CASE
(
contiguous_dyn_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
@@ -968,10 +942,8 @@ TEST_CASE(contiguous_dyn_test)
...
@@ -968,10 +942,8 @@ TEST_CASE(contiguous_dyn_test)
params
[
"X"
]
=
migraphx
::
argument
(
static_shape
,
data
.
data
());
params
[
"X"
]
=
migraphx
::
argument
(
static_shape
,
data
.
data
());
auto
result
=
p
.
eval
(
params
).
back
();
auto
result
=
p
.
eval
(
params
).
back
();
result.visit([&](auto output) {
std
::
vector
<
size_t
>
new_strides
=
{
12
,
4
,
2
,
1
};
std
::
vector
<
size_t
>
new_strides
=
{
12
,
4
,
2
,
1
};
EXPECT(bool{output.get_shape().strides() == new_strides});
EXPECT
(
result
.
get_shape
().
strides
()
==
new_strides
);
});
std
::
vector
<
float
>
results_vector
(
12
);
std
::
vector
<
float
>
results_vector
(
12
);
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
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