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
2edffaf5
Commit
2edffaf5
authored
Feb 02, 2019
by
Shucai Xiao
Browse files
clang format.
parent
a87890be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+1
-1
src/rewrite_gru.cpp
src/rewrite_gru.cpp
+5
-4
No files found.
src/onnx/onnx.cpp
View file @
2edffaf5
...
@@ -887,7 +887,7 @@ struct onnx_parser
...
@@ -887,7 +887,7 @@ struct onnx_parser
}
}
// append undefined opeator to make 6 arguments
// append undefined opeator to make 6 arguments
if
(
args
.
size
()
<
6
)
if
(
args
.
size
()
<
6
)
{
{
auto
ins
=
prog
.
add_instruction
(
op
::
undefined
{});
auto
ins
=
prog
.
add_instruction
(
op
::
undefined
{});
args
.
insert
(
args
.
end
(),
6
-
args
.
size
(),
ins
);
args
.
insert
(
args
.
end
(),
6
-
args
.
size
(),
ins
);
...
...
src/rewrite_gru.cpp
View file @
2edffaf5
...
@@ -22,7 +22,7 @@ void rewrite_gru::apply(program& prog) const
...
@@ -22,7 +22,7 @@ void rewrite_gru::apply(program& prog) const
shape
seq_shape
=
args
[
0
]
->
get_shape
();
shape
seq_shape
=
args
[
0
]
->
get_shape
();
std
::
size_t
hidden_size
=
args
[
2
]
->
get_shape
().
lens
()[
2
];
std
::
size_t
hidden_size
=
args
[
2
]
->
get_shape
().
lens
()[
2
];
std
::
size_t
batch_size
=
seq_shape
.
lens
()[
1
];
std
::
size_t
batch_size
=
seq_shape
.
lens
()[
1
];
shape
::
type_t
type
=
seq_shape
.
type
();
shape
::
type_t
type
=
seq_shape
.
type
();
migraphx
::
shape
ih_shape
{
type
,
{
1
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
type
,
{
1
,
batch_size
,
hidden_size
}};
std
::
vector
<
char
>
data
(
ih_shape
.
bytes
(),
0
);
std
::
vector
<
char
>
data
(
ih_shape
.
bytes
(),
0
);
...
@@ -52,8 +52,8 @@ void rewrite_gru::apply(program& prog) const
...
@@ -52,8 +52,8 @@ void rewrite_gru::apply(program& prog) const
instruction_ref
ih_forward
,
ih_reverse
;
instruction_ref
ih_forward
,
ih_reverse
;
if
(
args
.
size
()
==
6
&&
args
[
5
]
->
get_operator
().
name
()
!=
"undefined"
)
if
(
args
.
size
()
==
6
&&
args
[
5
]
->
get_operator
().
name
()
!=
"undefined"
)
{
{
ih_forward
=
prog
.
insert_instruction
(
ins
,
op
::
slice
{{
0
},
{
0
},
{
1
}},
args
[
5
]);
ih_forward
=
prog
.
insert_instruction
(
ins
,
op
::
slice
{{
0
},
{
0
},
{
1
}},
args
[
5
]);
ih_reverse
=
prog
.
insert_instruction
(
ins
,
op
::
slice
{{
0
},
{
1
},
{
2
}},
args
[
5
]);
ih_reverse
=
prog
.
insert_instruction
(
ins
,
op
::
slice
{{
0
},
{
1
},
{
2
}},
args
[
5
]);
}
}
else
else
{
{
...
@@ -93,7 +93,8 @@ void rewrite_gru::apply(program& prog) const
...
@@ -93,7 +93,8 @@ void rewrite_gru::apply(program& prog) const
ret_reverse
[
0
]
=
prog
.
insert_instruction
(
ins
,
op
::
unsqueeze
{{
1
}},
ret_reverse
[
0
]);
ret_reverse
[
0
]
=
prog
.
insert_instruction
(
ins
,
op
::
unsqueeze
{{
1
}},
ret_reverse
[
0
]);
// concat the forward and reverse output
// concat the forward and reverse output
auto
hidden_state
=
prog
.
replace_instruction
(
ins
,
op
::
concat
{
1
},
{
ret_forward
[
0
],
ret_reverse
[
0
]});
auto
hidden_state
=
prog
.
replace_instruction
(
ins
,
op
::
concat
{
1
},
{
ret_forward
[
0
],
ret_reverse
[
0
]});
map_last_output
[
hidden_state
]
=
last_output
;
map_last_output
[
hidden_state
]
=
last_output
;
}
}
else
else
...
...
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