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
ce2423ce
"vscode:/vscode.git/clone" did not exist on "d4b43b454a94492622037058ab8a80b8498e3741"
Commit
ce2423ce
authored
Mar 21, 2023
by
Paul
Browse files
Format
parent
9d1f9399
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+7
-5
No files found.
src/simplify_reshapes.cpp
View file @
ce2423ce
...
@@ -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
);
}
}
...
...
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