Commit 6ba5859b authored by Paul's avatar Paul
Browse files

Fix single dim

parent e70d4269
...@@ -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)
{ {
......
...@@ -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({});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment