Commit 8e832756 authored by Paul's avatar Paul
Browse files

Rename var

parent a7a4cd04
...@@ -74,7 +74,7 @@ template <class F> ...@@ -74,7 +74,7 @@ template <class F>
static void remove_contiguous(const std::string& op_name, module& m, F f) static void remove_contiguous(const std::string& op_name, module& m, F f)
{ {
auto last = std::prev(m.end()); auto last = std::prev(m.end());
std::vector<instruction_ref> const_instruction; std::vector<instruction_ref> const_instructions;
for(auto ins : iterator_for(m)) for(auto ins : iterator_for(m))
{ {
...@@ -112,24 +112,24 @@ static void remove_contiguous(const std::string& op_name, module& m, F f) ...@@ -112,24 +112,24 @@ static void remove_contiguous(const std::string& op_name, module& m, F f)
} }
else if(prev->can_eval()) else if(prev->can_eval())
{ {
const_instruction.push_back(arg); const_instructions.push_back(arg);
} }
} }
} }
} }
// Perform evaluations in parallel // Perform evaluations in parallel
std::vector<argument> literals(const_instruction.size()); std::vector<argument> literals(const_instructions.size());
par_for(const_instruction.size(), 1, [&](const auto i) { par_for(const_instructions.size(), 1, [&](const auto i) {
auto c = op::contiguous{}; auto c = op::contiguous{};
auto prev = const_instruction[i]->inputs().front(); auto prev = const_instructions[i]->inputs().front();
literals[i] = c.compute(c.compute_shape({prev->get_shape()}), {prev->eval()}); literals[i] = c.compute(c.compute_shape({prev->get_shape()}), {prev->eval()});
}); });
for(size_t i = 0; i < const_instruction.size(); i++) for(size_t i = 0; i < const_instructions.size(); i++)
{ {
auto l = m.add_literal(literals[i].get_shape(), literals[i].data()); auto l = m.add_literal(literals[i].get_shape(), literals[i].data());
m.replace_instruction(const_instruction[i], l); m.replace_instruction(const_instructions[i], l);
} }
} }
......
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