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
035a04eb
Commit
035a04eb
authored
Oct 24, 2022
by
Khalique Ahmed
Browse files
formatting
parent
b0d03793
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
src/rewrite_gemm.cpp
src/rewrite_gemm.cpp
+9
-6
No files found.
src/rewrite_gemm.cpp
View file @
035a04eb
...
@@ -44,17 +44,20 @@ void rewrite_gemm::apply(module& m) const
...
@@ -44,17 +44,20 @@ void rewrite_gemm::apply(module& m) const
if
(
ins
->
name
()
!=
"dot"
)
if
(
ins
->
name
()
!=
"dot"
)
continue
;
continue
;
auto
inputs
=
ins
->
inputs
();
auto
inputs
=
ins
->
inputs
();
auto
in0
=
inputs
.
at
(
0
);
auto
in0
=
inputs
.
at
(
0
);
if
(
in0
->
get_shape
().
lens
().
at
(
0
)
!=
1
)
// only batch size = 1
if
(
in0
->
get_shape
().
lens
().
at
(
0
)
!=
1
)
// only batch size = 1
continue
;
continue
;
auto
in1
=
inputs
.
at
(
1
);
auto
in1
=
inputs
.
at
(
1
);
auto
in0_transposed
=
m
.
insert_instruction
(
ins
,
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
3
,
1
,
2
}}}),
in0
);
auto
in0_transposed
=
auto
in1_transposed
=
m
.
insert_instruction
(
ins
,
make_op
(
"transpose"
,
{{
"permutation"
,
{
3
,
2
,
1
,
0
}}}),
in1
);
m
.
insert_instruction
(
ins
,
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
3
,
1
,
2
}}}),
in0
);
auto
in1_transposed
=
auto
conv
=
make_op
(
"convolution"
);
m
.
insert_instruction
(
ins
,
make_op
(
"transpose"
,
{{
"permutation"
,
{
3
,
2
,
1
,
0
}}}),
in1
);
auto
conv
=
make_op
(
"convolution"
);
auto
conv_out
=
m
.
replace_instruction
(
ins
,
conv
,
{
in0_transposed
,
in1_transposed
});
auto
conv_out
=
m
.
replace_instruction
(
ins
,
conv
,
{
in0_transposed
,
in1_transposed
});
auto
conv_transpose
=
m
.
add_instruction
(
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
3
,
1
}}}),
conv_out
);
auto
conv_transpose
=
m
.
add_instruction
(
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
3
,
1
}}}),
conv_out
);
// m.insert_instruction(std::next(conv_transpose), make_op("unsqueeze"));
// m.insert_instruction(std::next(conv_transpose), make_op("unsqueeze"));
}
}
}
}
...
...
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