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
001180f5
Unverified
Commit
001180f5
authored
May 25, 2022
by
Chris Austen
Committed by
GitHub
May 25, 2022
Browse files
Merge branch 'develop' into jit-contiguous
parents
dc296a73
4e18f991
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
test/onnx/verify_onnx.cpp
test/onnx/verify_onnx.cpp
+27
-0
test/reduce_dims.cpp
test/reduce_dims.cpp
+23
-0
No files found.
test/onnx/verify_onnx.cpp
View file @
001180f5
...
@@ -581,6 +581,33 @@ TEST_CASE(mean_test)
...
@@ -581,6 +581,33 @@ TEST_CASE(mean_test)
EXPECT
(
migraphx
::
verify_range
(
result_vector
,
gold
));
EXPECT
(
migraphx
::
verify_range
(
result_vector
,
gold
));
}
}
TEST_CASE
(
mean_integral_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mean_integral_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{});
migraphx
::
shape
s
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
2
}};
const
int
num_elms
=
8
;
const
int
num_data
=
10
;
const
std
::
vector
<
int
>
scalars
{
1
,
5
,
14
,
2
,
6
,
21
,
101
,
0
,
-
4
,
-
11
};
std
::
vector
<
std
::
vector
<
int
>>
data
;
std
::
transform
(
scalars
.
begin
(),
scalars
.
end
(),
std
::
back_inserter
(
data
),
[
&
](
const
auto
i
)
{
return
std
::
vector
<
int
>
(
num_elms
,
i
);
});
migraphx
::
parameter_map
pp
;
for
(
std
::
size_t
i
=
0
;
i
<
num_data
;
++
i
)
pp
[
std
::
to_string
(
i
)]
=
migraphx
::
argument
(
s
,
data
[
i
].
data
());
auto
result
=
p
.
eval
(
pp
).
back
();
std
::
vector
<
double
>
result_vector
;
result
.
visit
([
&
](
auto
output
)
{
result_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
const
auto
mean
=
std
::
accumulate
(
scalars
.
begin
(),
scalars
.
end
(),
0
)
/
num_data
;
std
::
vector
<
int
>
gold
(
num_elms
,
mean
);
EXPECT
(
migraphx
::
verify_range
(
result_vector
,
gold
));
}
TEST_CASE
(
nonzero_test
)
TEST_CASE
(
nonzero_test
)
{
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"nonzero_dynamic_test.onnx"
);
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"nonzero_dynamic_test.onnx"
);
...
...
test/reduce_dims.cpp
View file @
001180f5
...
@@ -109,6 +109,29 @@ TEST_CASE(transposed1)
...
@@ -109,6 +109,29 @@ TEST_CASE(transposed1)
EXPECT
(
eshapes
==
rshapes
);
EXPECT
(
eshapes
==
rshapes
);
}
}
TEST_CASE
(
non_packed_empty1
)
{
std
::
vector
<
migraphx
::
shape
>
ishapes
=
{
make_shape
({
1
,
12
},
{
589824
,
64
})};
std
::
vector
<
migraphx
::
shape
>
eshapes
=
{
make_shape
({
12
},
{
64
})};
auto
rshapes
=
migraphx
::
reduce_dims
(
ishapes
);
EXPECT
(
eshapes
==
rshapes
);
}
TEST_CASE
(
non_packed_empty2
)
{
std
::
vector
<
migraphx
::
shape
>
ishapes
=
{
make_shape
({
12
,
1
},
{
64
,
589824
})};
std
::
vector
<
migraphx
::
shape
>
eshapes
=
{
make_shape
({
12
},
{
64
})};
auto
rshapes
=
migraphx
::
reduce_dims
(
ishapes
);
EXPECT
(
eshapes
==
rshapes
);
}
TEST_CASE
(
single_dim
)
{
std
::
vector
<
migraphx
::
shape
>
ishapes
=
{
make_shape
({
1
},
{
1
})};
auto
rshapes
=
migraphx
::
reduce_dims
(
ishapes
);
EXPECT
(
ishapes
==
rshapes
);
}
TEST_CASE
(
empty
)
TEST_CASE
(
empty
)
{
{
auto
rshapes
=
migraphx
::
reduce_dims
({});
auto
rshapes
=
migraphx
::
reduce_dims
({});
...
...
Prev
1
2
Next
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