Commit b23aec08 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 2d7f3523
...@@ -50,7 +50,8 @@ void rewrite_gru::apply(program& prog) const ...@@ -50,7 +50,8 @@ void rewrite_gru::apply(program& prog) const
// intial hidden state // intial hidden state
instruction_ref ih_forward, ih_reverse; instruction_ref ih_forward, ih_reverse;
if(args.size() == 6 || (args.size() == 5 && args[4]->get_shape().lens().size() == 3)) if(args.size() == 6 ||
(args.size() == 5 && args[4]->get_shape().lens().size() == 3))
{ {
auto arg_ih = (args.size() == 6) ? args[5] : args[4]; auto arg_ih = (args.size() == 6) ? args[5] : args[4];
ih_forward = prog.insert_instruction(ins, op::slice{{0}, {0}, {1}}, arg_ih); ih_forward = prog.insert_instruction(ins, op::slice{{0}, {0}, {1}}, arg_ih);
...@@ -86,7 +87,8 @@ void rewrite_gru::apply(program& prog) const ...@@ -86,7 +87,8 @@ void rewrite_gru::apply(program& prog) const
gru_op.actv_funcs.at(2), gru_op.actv_funcs.at(2),
gru_op.actv_funcs.at(3)); gru_op.actv_funcs.at(3));
last_output = prog.insert_instruction(ins, op::concat{0}, ret_forward[1], ret_reverse[1]); last_output =
prog.insert_instruction(ins, op::concat{0}, ret_forward[1], ret_reverse[1]);
// add the dimension of num_direction // add the dimension of num_direction
ret_forward[0] = prog.insert_instruction(ins, op::unsqueeze{{1}}, ret_forward[0]); ret_forward[0] = prog.insert_instruction(ins, op::unsqueeze{{1}}, ret_forward[0]);
...@@ -111,9 +113,10 @@ void rewrite_gru::apply(program& prog) const ...@@ -111,9 +113,10 @@ void rewrite_gru::apply(program& prog) const
// intial hidden state // intial hidden state
instruction_ref ih; instruction_ref ih;
if(args.size() == 6 || (args.size() == 5 && args[4]->get_shape().lens().size() == 3)) if(args.size() == 6 ||
(args.size() == 5 && args[4]->get_shape().lens().size() == 3))
{ {
ih = args.size() == 6 ? args[5]: args[4]; ih = args.size() == 6 ? args[5] : args[4];
} }
else else
{ {
...@@ -143,9 +146,9 @@ void rewrite_gru::apply(program& prog) const ...@@ -143,9 +146,9 @@ void rewrite_gru::apply(program& prog) const
// operator. Intuitively, we can do a slice on its input to get // operator. Intuitively, we can do a slice on its input to get
// the last output, but it is already existed in the rnn operator, // the last output, but it is already existed in the rnn operator,
// so we can just use it as the output here // so we can just use it as the output here
if (ins->name() == "gru_last_output") if(ins->name() == "gru_last_output")
{ {
if (last_output != prog.end()) if(last_output != prog.end())
{ {
prog.replace_instruction(ins, op::identity{}, last_output); prog.replace_instruction(ins, op::identity{}, last_output);
last_output = prog.end(); last_output = prog.end();
......
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