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
96a4cec2
Commit
96a4cec2
authored
Feb 08, 2022
by
Shucai Xiao
Browse files
remove unnecessary changes
parent
3b46ba9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
29 deletions
+1
-29
src/eliminate_contiguous.cpp
src/eliminate_contiguous.cpp
+1
-16
test/eliminate_contiguous_test.cpp
test/eliminate_contiguous_test.cpp
+0
-13
No files found.
src/eliminate_contiguous.cpp
View file @
96a4cec2
...
@@ -74,23 +74,8 @@ void eliminate_contiguous::apply(module& p) const
...
@@ -74,23 +74,8 @@ void eliminate_contiguous::apply(module& p) const
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
// return instruction should have inputs with standard shape
// return instruction should have inputs with standard shape
if
(
ins
->
name
()
==
"@return"
)
if
(
ins
->
name
()
==
"@return"
)
{
auto
args
=
ins
->
inputs
();
std
::
transform
(
args
.
begin
(),
args
.
end
(),
args
.
begin
(),
[
&
](
auto
in
)
{
if
(
in
->
name
()
!=
op_name
)
return
in
;
auto
prev
=
in
->
inputs
().
front
();
return
prev
->
get_shape
().
standard
()
?
prev
:
in
;
});
if
(
args
!=
ins
->
inputs
())
{
p
.
replace_instruction
(
ins
,
ins
->
get_operator
(),
args
);
}
continue
;
continue
;
}
// Make a copy so we can modify it while we iterate
// Make a copy so we can modify it while we iterate
auto
args
=
ins
->
inputs
();
auto
args
=
ins
->
inputs
();
...
...
test/eliminate_contiguous_test.cpp
View file @
96a4cec2
...
@@ -161,19 +161,6 @@ TEST_CASE(standard_flatten_op)
...
@@ -161,19 +161,6 @@ TEST_CASE(standard_flatten_op)
EXPECT
(
std
::
distance
(
m
.
begin
(),
m
.
end
())
==
(
count
-
1
));
EXPECT
(
std
::
distance
(
m
.
begin
(),
m
.
end
())
==
(
count
-
1
));
}
}
TEST_CASE
(
standard_return_input
)
{
migraphx
::
module
m
;
auto
l
=
m
.
add_literal
(
get_2x2
());
auto
tl
=
m
.
add_instruction
(
migraphx
::
make_op
(
"add"
),
l
,
l
);
auto
c
=
m
.
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
tl
);
m
.
add_return
({
c
});
auto
count
=
std
::
distance
(
m
.
begin
(),
m
.
end
());
run_pass
(
m
);
EXPECT
(
std
::
distance
(
m
.
begin
(),
m
.
end
())
==
count
-
1
);
}
TEST_CASE
(
contiguous_pointwise
)
TEST_CASE
(
contiguous_pointwise
)
{
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
8
,
8
}};
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
8
,
8
}};
...
...
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