"vscode:/vscode.git/clone" did not exist on "d4b43b454a94492622037058ab8a80b8498e3741"
Commit ce2423ce authored by Paul's avatar Paul
Browse files

Format

parent 9d1f9399
...@@ -89,18 +89,20 @@ struct find_reshaper ...@@ -89,18 +89,20 @@ struct find_reshaper
auto matcher() const auto matcher() const
{ {
auto no_output_reshape = match::none_of[match::outputs()](match::name(reshaper_names())); auto no_output_reshape = match::none_of[match::outputs()](match::name(reshaper_names()));
auto input_reshape = match::arg(0)(match::skip(match::name("contiguous"))(match::name(reshaper_names()))); auto input_reshape =
auto input = match::skip(match::name(reshaper_names()), match::name("contiguous"))(match::arg(0).bind("x")); match::arg(0)(match::skip(match::name("contiguous"))(match::name(reshaper_names())));
auto input = match::skip(match::name(reshaper_names()),
match::name("contiguous"))(match::arg(0).bind("x"));
return match::name(reshaper_names())(no_output_reshape, input_reshape, input); return match::name(reshaper_names())(no_output_reshape, input_reshape, input);
} }
void apply(module& m, const match::matcher_result& mr) const void apply(module& m, const match::matcher_result& mr) const
{ {
auto ins = mr.result; auto ins = mr.result;
auto input = mr.instructions["x"]; auto input = mr.instructions["x"];
auto dims = ins->get_shape().lens(); auto dims = ins->get_shape().lens();
if (not input->get_shape().standard()) if(not input->get_shape().standard())
input = m.insert_instruction(input, make_op("contiguous"), input); input = m.insert_instruction(input, make_op("contiguous"), input);
m.replace_instruction(ins, make_op("reshape", {{"dims", dims}}), input); m.replace_instruction(ins, make_op("reshape", {{"dims", dims}}), input);
} }
......
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