Commit cf3dbd36 authored by Paul's avatar Paul
Browse files

Formatting

parent 3405e5bc
...@@ -12,7 +12,7 @@ void auto_contiguous::apply(module& p) const ...@@ -12,7 +12,7 @@ void auto_contiguous::apply(module& p) const
{ {
for(auto ins : iterator_for(p)) for(auto ins : iterator_for(p))
{ {
if (ins->name() == "layout") if(ins->name() == "layout")
continue; continue;
shape s = ins->get_shape(); shape s = ins->get_shape();
if(not s.standard() and s.elements() != 0) if(not s.standard() and s.elements() != 0)
......
...@@ -73,12 +73,12 @@ void eliminate_contiguous::apply(module& p) const ...@@ -73,12 +73,12 @@ void eliminate_contiguous::apply(module& p) const
if(ins->name() == "@return") if(ins->name() == "@return")
continue; continue;
if (std::none_of(ins->inputs().begin(), ins->inputs().end(), [&](auto arg) { if(std::none_of(ins->inputs().begin(), ins->inputs().end(), [&](auto arg) {
return arg->name() == op_name; return arg->name() == op_name;
})) }))
continue; continue;
// Make a copy so we can modify it while we iterate // Make a copy so we can modify it while we iterate
auto args = ins->inputs(); auto args = ins->inputs();
auto new_args = args; auto new_args = args;
std::transform(new_args.begin(), new_args.end(), new_args.begin(), [&](auto arg) { std::transform(new_args.begin(), new_args.end(), new_args.begin(), [&](auto arg) {
if(arg->name() == op_name) if(arg->name() == op_name)
...@@ -90,9 +90,9 @@ void eliminate_contiguous::apply(module& p) const ...@@ -90,9 +90,9 @@ void eliminate_contiguous::apply(module& p) const
if(try_compute_shape(ins, new_args)) if(try_compute_shape(ins, new_args))
{ {
for(auto i:range(args.size())) for(auto i : range(args.size()))
{ {
if (args[i] == new_args[i]) if(args[i] == new_args[i])
continue; continue;
instruction::replace_argument(ins, args[i], new_args[i]); instruction::replace_argument(ins, args[i], new_args[i]);
} }
...@@ -103,8 +103,8 @@ void eliminate_contiguous::apply(module& p) const ...@@ -103,8 +103,8 @@ void eliminate_contiguous::apply(module& p) const
{ {
if(arg->name() == op_name) if(arg->name() == op_name)
{ {
new_args = args; new_args = args;
auto prev = arg->inputs().front(); auto prev = arg->inputs().front();
replace(new_args, arg, prev); replace(new_args, arg, prev);
if(try_compute_shape(ins, new_args)) if(try_compute_shape(ins, new_args))
{ {
...@@ -121,8 +121,6 @@ void eliminate_contiguous::apply(module& p) const ...@@ -121,8 +121,6 @@ void eliminate_contiguous::apply(module& p) const
} }
} }
} }
} }
} }
......
...@@ -165,7 +165,10 @@ struct dnnl_op : auto_register_op<Derived> ...@@ -165,7 +165,10 @@ struct dnnl_op : auto_register_op<Derived>
i++; i++;
} }
} }
shape adjust_shape(const shape& s, int, const shape& output) const { return base_adjust_shape(s, output); } shape adjust_shape(const shape& s, int, const shape& output) const
{
return base_adjust_shape(s, output);
}
std::vector<int> create_arg_map(std::size_t input_size) const std::vector<int> create_arg_map(std::size_t input_size) const
{ {
const auto& self = static_cast<const Derived&>(*this); const auto& self = static_cast<const Derived&>(*this);
...@@ -184,8 +187,9 @@ struct dnnl_op : auto_register_op<Derived> ...@@ -184,8 +187,9 @@ struct dnnl_op : auto_register_op<Derived>
{ {
const auto& self = static_cast<const Derived&>(*this); const auto& self = static_cast<const Derived&>(*this);
std::unordered_map<int, dnnl::memory::desc> result; std::unordered_map<int, dnnl::memory::desc> result;
result[DNNL_ARG_DST] = to_dnnl_memory_desc(self.adjust_shape(output_shape, inputs.size(), output_shape)); result[DNNL_ARG_DST] =
auto m = create_arg_map(inputs.size()); to_dnnl_memory_desc(self.adjust_shape(output_shape, inputs.size(), output_shape));
auto m = create_arg_map(inputs.size());
assert(m.size() >= inputs.size()); assert(m.size() >= inputs.size());
for(int i = 0; i < inputs.size(); i++) for(int i = 0; i < inputs.size(); i++)
{ {
......
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