Commit 5f7826da authored by Paul's avatar Paul
Browse files

Formatting

parent dcb15c2b
...@@ -52,7 +52,7 @@ std::vector<int64_t> reorder_dims(std::vector<int64_t> dims, std::vector<int64_t ...@@ -52,7 +52,7 @@ std::vector<int64_t> reorder_dims(std::vector<int64_t> dims, std::vector<int64_t
{ {
std::vector<int64_t> result(dims.size()); std::vector<int64_t> result(dims.size());
assert(dims.size() == permutation.size()); assert(dims.size() == permutation.size());
for(std::size_t i = 0;i <dims.size();i++) for(std::size_t i = 0; i < dims.size(); i++)
{ {
result[i] = dims[permutation[i]]; result[i] = dims[permutation[i]];
} }
...@@ -61,13 +61,12 @@ std::vector<int64_t> reorder_dims(std::vector<int64_t> dims, std::vector<int64_t ...@@ -61,13 +61,12 @@ std::vector<int64_t> reorder_dims(std::vector<int64_t> dims, std::vector<int64_t
bool is_no_transpose(const std::vector<int64_t>& dims) bool is_no_transpose(const std::vector<int64_t>& dims)
{ {
if (dims.empty()) if(dims.empty())
return true; return true;
if (dims.front() != 0) if(dims.front() != 0)
return false; return false;
return std::adjacent_find(dims.begin(), dims.end(), [](auto x, auto y) { return std::adjacent_find(
return (y - x) != 1; dims.begin(), dims.end(), [](auto x, auto y) { return (y - x) != 1; }) == dims.end();
}) == dims.end();
} }
void simplify_reshapes::apply(program& p) const void simplify_reshapes::apply(program& p) const
...@@ -127,7 +126,7 @@ void simplify_reshapes::apply(program& p) const ...@@ -127,7 +126,7 @@ void simplify_reshapes::apply(program& p) const
} while(x != t and t->name() == "transpose"); } while(x != t and t->name() == "transpose");
if(t == ins or t->name() != "transpose") if(t == ins or t->name() != "transpose")
continue; continue;
if (is_no_transpose(dims)) if(is_no_transpose(dims))
{ {
p.replace_instruction(ins, t->inputs().front()); p.replace_instruction(ins, t->inputs().front());
} }
......
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