Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
b23aec08
"vscode:/vscode.git/clone" did not exist on "6f345a52b8e00eb84a76fe0d2610c882ca33bba8"
Commit
b23aec08
authored
Jan 28, 2019
by
Shucai Xiao
Browse files
clang format
parent
2d7f3523
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
49 deletions
+52
-49
src/rewrite_gru.cpp
src/rewrite_gru.cpp
+52
-49
No files found.
src/rewrite_gru.cpp
View file @
b23aec08
...
...
@@ -50,7 +50,8 @@ void rewrite_gru::apply(program& prog) const
// intial hidden state
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
];
ih_forward
=
prog
.
insert_instruction
(
ins
,
op
::
slice
{{
0
},
{
0
},
{
1
}},
arg_ih
);
...
...
@@ -86,7 +87,8 @@ void rewrite_gru::apply(program& prog) const
gru_op
.
actv_funcs
.
at
(
2
),
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
ret_forward
[
0
]
=
prog
.
insert_instruction
(
ins
,
op
::
unsqueeze
{{
1
}},
ret_forward
[
0
]);
...
...
@@ -111,9 +113,10 @@ void rewrite_gru::apply(program& prog) const
// intial hidden state
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
{
...
...
@@ -143,9 +146,9 @@ void rewrite_gru::apply(program& prog) const
// operator. Intuitively, we can do a slice on its input to get
// the last output, but it is already existed in the rnn operator,
// 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
);
last_output
=
prog
.
end
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment