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
d976ecfe
Commit
d976ecfe
authored
Mar 31, 2023
by
Paul
Browse files
Add missing transpose
parent
8724e73f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+11
-3
No files found.
src/simplify_algebra.cpp
View file @
d976ecfe
...
@@ -299,11 +299,19 @@ struct find_dot_mul
...
@@ -299,11 +299,19 @@ struct find_dot_mul
}
}
auto
broadcast_v
=
d_ins
->
get_operator
().
to_value
();
auto
broadcast_v
=
d_ins
->
get_operator
().
to_value
();
broadcast_v
[
"out_lens"
]
=
c_ins
->
get_shape
().
lens
();
auto
c_lens
=
c_ins
->
get_shape
().
lens
();
std
::
vector
<
int64_t
>
permutation
(
c_lens
.
size
());
std
::
iota
(
permutation
.
begin
(),
permutation
.
end
(),
0
);
if
(
c_ins
==
b_ins
)
{
std
::
swap
(
permutation
.
back
(),
permutation
[
permutation
.
size
()
-
2
]);
c_lens
=
reorder_dims
(
c_lens
,
permutation
);
}
broadcast_v
[
"out_lens"
]
=
c_lens
;
auto
db_ins
=
auto
db_ins
=
m
.
insert_instruction
(
ins
,
make_op
(
d_ins
->
name
(),
broadcast_v
),
d_ins
->
inputs
());
m
.
insert_instruction
(
ins
,
make_op
(
d_ins
->
name
(),
broadcast_v
),
d_ins
->
inputs
());
auto
cd_ins
=
m
.
insert_instruction
(
ins
,
make_op
(
"mul"
),
c_ins
,
db_ins
);
auto
db_transpose_ins
=
m
.
insert_instruction
(
ins
,
make_op
(
"transpose"
,
{{
"permutation"
,
permutation
}}),
db_ins
);
auto
cd_ins
=
m
.
insert_instruction
(
ins
,
make_op
(
"mul"
),
c_ins
,
db_transpose_ins
);
if
(
c_ins
==
b_ins
)
if
(
c_ins
==
b_ins
)
{
{
...
...
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