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
6ba5859b
Commit
6ba5859b
authored
May 18, 2022
by
Paul
Browse files
Fix single dim
parent
e70d4269
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
src/reduce_dims.cpp
src/reduce_dims.cpp
+1
-1
test/reduce_dims.cpp
test/reduce_dims.cpp
+7
-0
No files found.
src/reduce_dims.cpp
View file @
6ba5859b
...
@@ -38,7 +38,7 @@ bool reduce_dim(std::vector<shape>& shapes, std::size_t n)
...
@@ -38,7 +38,7 @@ bool reduce_dim(std::vector<shape>& shapes, std::size_t n)
void
reduce_dim1
(
std
::
vector
<
shape
>&
shapes
)
void
reduce_dim1
(
std
::
vector
<
shape
>&
shapes
)
{
{
if
(
std
::
any_of
(
if
(
std
::
any_of
(
shapes
.
begin
(),
shapes
.
end
(),
[
&
](
const
auto
&
s
)
{
return
s
.
lens
().
back
()
!=
1
;
}))
shapes
.
begin
(),
shapes
.
end
(),
[
&
](
const
auto
&
s
)
{
return
s
.
lens
().
size
()
<
2
or
s
.
lens
().
back
()
!=
1
;
}))
return
;
return
;
for
(
auto
&
s
:
shapes
)
for
(
auto
&
s
:
shapes
)
{
{
...
...
test/reduce_dims.cpp
View file @
6ba5859b
...
@@ -125,6 +125,13 @@ TEST_CASE(non_packed_empty2)
...
@@ -125,6 +125,13 @@ TEST_CASE(non_packed_empty2)
EXPECT
(
eshapes
==
rshapes
);
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
({});
...
...
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