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
a7c83234
Commit
a7c83234
authored
Aug 25, 2023
by
Khalique Ahmed
Browse files
formatting
parent
59f6009b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+13
-8
test/simplify_reshapes_test.cpp
test/simplify_reshapes_test.cpp
+7
-5
No files found.
src/simplify_reshapes.cpp
View file @
a7c83234
...
...
@@ -631,7 +631,8 @@ struct find_broadcast_transpose
{
auto
matcher
()
const
{
return
match
::
name
(
"multibroadcast"
)(
match
::
all_of
[
match
::
outputs
()](
match
::
name
(
"transpose"
).
bind
(
"trans_ins"
)));
return
match
::
name
(
"multibroadcast"
)(
match
::
all_of
[
match
::
outputs
()](
match
::
name
(
"transpose"
).
bind
(
"trans_ins"
)));
}
void
apply
(
module
&
m
,
const
match
::
matcher_result
&
r
)
const
...
...
@@ -669,8 +670,12 @@ struct find_broadcast_transpose
}
}
auto
unsqueeze_ins
=
m
.
insert_instruction
(
trans_ins
,
make_op
(
"unsqueeze"
,
{{
"axes"
,
unsqueeze_axes
}}),
input
);
auto
mbcast_ins
=
m
.
insert_instruction
(
trans_ins
,
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
trans_shape
.
lens
()}}),
unsqueeze_ins
);
auto
unsqueeze_ins
=
m
.
insert_instruction
(
trans_ins
,
make_op
(
"unsqueeze"
,
{{
"axes"
,
unsqueeze_axes
}}),
input
);
auto
mbcast_ins
=
m
.
insert_instruction
(
trans_ins
,
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
trans_shape
.
lens
()}}),
unsqueeze_ins
);
m
.
replace_instruction
(
trans_ins
,
mbcast_ins
);
}
};
...
...
test/simplify_reshapes_test.cpp
View file @
a7c83234
...
...
@@ -207,7 +207,8 @@ TEST_CASE(broadcast_transpose)
auto
*
mm
=
p
.
get_main_module
();
auto
l
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
1024
}});
auto
mb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
3072
,
1024
}}}),
l
);
auto
mb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
3072
,
1024
}}}),
l
);
auto
t1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
1
}}}),
mb
);
mm
->
add_return
({
t1
});
...
...
@@ -216,7 +217,8 @@ TEST_CASE(broadcast_transpose)
mm
=
p2
.
get_main_module
();
l
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
1024
}});
auto
unsqueeze
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
0
,
2
}}}),
l
);
mb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
1024
,
3072
}}}),
unsqueeze
);
mb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
1024
,
3072
}}}),
unsqueeze
);
mm
->
add_return
({
mb
});
EXPECT
(
p
==
p2
);
// EXPECT(not mm->get_output_shapes().back().standard());
...
...
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