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
52f44f87
"vscode:/vscode.git/clone" did not exist on "6e967f507dc429b1456e3deb92233c7f2c08c0dd"
Commit
52f44f87
authored
Aug 12, 2018
by
Paul
Browse files
Formatting
parent
d2a38cd4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+10
-10
No files found.
src/simplify_reshapes.cpp
View file @
52f44f87
...
@@ -10,12 +10,10 @@ namespace migraph {
...
@@ -10,12 +10,10 @@ namespace migraph {
bool
is_reshaper
(
const
std
::
string
&
name
)
bool
is_reshaper
(
const
std
::
string
&
name
)
{
{
static
const
std
::
unordered_set
<
std
::
string
>
names
=
{
static
const
std
::
unordered_set
<
std
::
string
>
names
=
{
"reshape"
,
"reshape"
,
"transpose"
,
"transpose"
,
// "broadcast",
// "broadcast",
"contiguous"
"contiguous"
};
};
return
contains
(
names
,
name
);
return
contains
(
names
,
name
);
}
}
...
@@ -39,17 +37,19 @@ void simplify_reshapes::apply(program& p) const
...
@@ -39,17 +37,19 @@ void simplify_reshapes::apply(program& p) const
}
}
std
::
pair
<
instruction_ref
,
instruction_ref
>
r
{
p
.
end
(),
p
.
end
()};
std
::
pair
<
instruction_ref
,
instruction_ref
>
r
{
p
.
end
(),
p
.
end
()};
for
(
auto
start
:
iterator_for
(
reshapes
))
for
(
auto
start
:
iterator_for
(
reshapes
))
{
{
auto
last
=
std
::
find_if
(
reshapes
.
rbegin
(),
reshapes
.
rend
(),
[
&
](
auto
&&
i
)
{
auto
last
=
std
::
find_if
(
reshapes
.
rbegin
(),
reshapes
.
rend
(),
[
&
](
auto
&&
i
)
{
return
i
->
result
==
(
*
start
)
->
result
and
i
!=
(
*
start
);
return
i
->
result
==
(
*
start
)
->
result
and
i
!=
(
*
start
);
});
});
if
(
last
!=
reshapes
.
rend
())
{
if
(
last
!=
reshapes
.
rend
())
{
r
=
std
::
make_pair
(
*
start
,
*
last
);
r
=
std
::
make_pair
(
*
start
,
*
last
);
break
;
break
;
}
}
}
}
if
(
r
.
first
!=
r
.
second
)
{
if
(
r
.
first
!=
r
.
second
)
{
p
.
replace_instruction
(
r
.
first
,
r
.
second
);
p
.
replace_instruction
(
r
.
first
,
r
.
second
);
}
}
}
}
...
...
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