Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
128b0b65
Commit
128b0b65
authored
Jan 25, 2019
by
Shucai Xiao
Browse files
clang format
parent
f2436c3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+6
-6
src/rewrite_rnn.cpp
src/rewrite_rnn.cpp
+9
-2
No files found.
src/onnx/onnx.cpp
View file @
128b0b65
...
@@ -685,10 +685,10 @@ struct onnx_parser
...
@@ -685,10 +685,10 @@ struct onnx_parser
{
{
auto
names
=
attributes
.
at
(
"activations"
).
strings
();
auto
names
=
attributes
.
at
(
"activations"
).
strings
();
vec_names
.
clear
();
vec_names
.
clear
();
for_each
(
names
.
begin
(),
names
.
end
(),
[
&
](
auto
&
fn
)
{
vec_names
.
push_back
(
fn
);
}
);
for_each
(
names
.
begin
(),
names
.
end
(),
[
&
](
auto
&
fn
)
{
vec_names
.
push_back
(
fn
);
});
}
}
for_each
(
vec_names
.
begin
(),
vec_names
.
end
(),
[
&
]
(
auto
&
fn
)
{
for_each
(
vec_names
.
begin
(),
vec_names
.
end
(),
[
&
](
auto
&
fn
)
{
if
(
map_actv_funcs
.
count
(
fn
)
==
0
)
if
(
map_actv_funcs
.
count
(
fn
)
==
0
)
{
{
MIGRAPHX_THROW
(
"RNN: activation function "
+
fn
+
" not supported"
);
MIGRAPHX_THROW
(
"RNN: activation function "
+
fn
+
" not supported"
);
...
@@ -698,19 +698,19 @@ struct onnx_parser
...
@@ -698,19 +698,19 @@ struct onnx_parser
// bidirectional should have two activation functions
// bidirectional should have two activation functions
// if only one actv function is provides, we use it in both
// if only one actv function is provides, we use it in both
// forward and reverse direction
// forward and reverse direction
if
(
dirct
==
op
::
rnn
::
bidirectional
)
if
(
dirct
==
op
::
rnn
::
bidirectional
)
{
{
if
(
vec_names
.
size
()
==
1
)
if
(
vec_names
.
size
()
==
1
)
{
{
vec_names
.
push_back
(
vec_names
.
at
(
0
));
vec_names
.
push_back
(
vec_names
.
at
(
0
));
}
}
}
}
std
::
vector
<
operation
>
vec_actv_funcs
;
std
::
vector
<
operation
>
vec_actv_funcs
;
for_each
(
vec_names
.
begin
(),
vec_names
.
end
(),
[
&
]
(
auto
&
fn
)
{
for_each
(
vec_names
.
begin
(),
vec_names
.
end
(),
[
&
](
auto
&
fn
)
{
vec_actv_funcs
.
push_back
(
map_actv_funcs
[
fn
]);
vec_actv_funcs
.
push_back
(
map_actv_funcs
[
fn
]);
});
});
// To be added later
// To be added later
float
clip
=
0.0
;
float
clip
=
0.0
;
if
(
contains
(
attributes
,
"clip"
))
if
(
contains
(
attributes
,
"clip"
))
...
...
src/rewrite_rnn.cpp
View file @
128b0b65
...
@@ -160,8 +160,15 @@ void rewrite_rnn::apply(program& prog) const
...
@@ -160,8 +160,15 @@ void rewrite_rnn::apply(program& prog) const
{
{
ih
=
prog
.
add_literal
(
migraphx
::
literal
{
s
,
data
});
ih
=
prog
.
add_literal
(
migraphx
::
literal
{
s
,
data
});
}
}
auto
ret
=
rnn_oper
(
auto
ret
=
rnn_oper
(
is_forward
,
is_forward
,
prog
,
ins
,
args
[
0
],
trans_xw
,
trans_hw
,
ih
,
bias
,
rnn_op
.
actv_funcs
.
at
(
0
));
prog
,
ins
,
args
[
0
],
trans_xw
,
trans_hw
,
ih
,
bias
,
rnn_op
.
actv_funcs
.
at
(
0
));
// add the dimension of num_direction
// add the dimension of num_direction
prog
.
replace_instruction
(
ins
,
op
::
unsqueeze
{{
1
}},
ret
[
0
]);
prog
.
replace_instruction
(
ins
,
op
::
unsqueeze
{{
1
}},
ret
[
0
]);
...
...
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