Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
7a095dd8
Commit
7a095dd8
authored
Feb 25, 2019
by
Shucai Xiao
Browse files
remove unnecessary code.
parent
1871d141
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
24 deletions
+0
-24
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+0
-24
No files found.
src/onnx/onnx.cpp
View file @
7a095dd8
...
...
@@ -470,17 +470,6 @@ struct onnx_parser
transb
=
parse_value
(
attributes
.
at
(
"transB"
)).
at
<
bool
>
();
}
// beginning or end of both args have dimension 1, need to squeeze
// before calling gemm, then doing unsqueeze after getting results
std
::
size_t
num_squeeze
=
args
[
0
]
->
get_shape
().
lens
().
size
();
if
(
num_squeeze
>
2
)
{
std
::
vector
<
int64_t
>
vec_axises
(
num_squeeze
-
2
);
std
::
iota
(
vec_axises
.
begin
(),
vec_axises
.
end
(),
0
);
args
[
0
]
=
prog
.
add_instruction
(
op
::
squeeze
{
vec_axises
},
args
[
0
]);
args
[
1
]
=
prog
.
add_instruction
(
op
::
squeeze
{
vec_axises
},
args
[
1
]);
}
std
::
vector
<
int64_t
>
perm
=
{
1
,
0
};
auto
l1
=
(
transa
)
?
prog
.
add_instruction
(
op
::
transpose
{
perm
},
args
[
0
])
:
args
[
0
];
auto
l2
=
(
transb
)
?
prog
.
add_instruction
(
op
::
transpose
{
perm
},
args
[
1
])
:
args
[
1
];
...
...
@@ -489,13 +478,6 @@ struct onnx_parser
if
(
beta
!=
0.
f
)
{
auto
l3
=
prog
.
add_instruction
(
op
::
dot
{
alpha
},
l1
,
l2
);
if
(
num_squeeze
>
2
)
{
std
::
vector
<
int64_t
>
vec_axises
(
num_squeeze
-
2
);
std
::
iota
(
vec_axises
.
begin
(),
vec_axises
.
end
(),
0
);
l3
=
prog
.
add_instruction
(
op
::
unsqueeze
{
vec_axises
},
l3
);
}
auto
l4
=
args
[
2
];
if
(
l4
->
get_shape
().
scalar
())
// ignore args[2] (no C value added to alpha*A*B)
return
l3
;
...
...
@@ -510,12 +492,6 @@ struct onnx_parser
}
auto
dot_res
=
prog
.
add_instruction
(
op
::
dot
{
alpha
,
beta
},
l1
,
l2
);
if
(
num_squeeze
>
2
)
{
std
::
vector
<
int64_t
>
vec_axises
(
num_squeeze
-
2
);
std
::
iota
(
vec_axises
.
begin
(),
vec_axises
.
end
(),
0
);
dot_res
=
prog
.
add_instruction
(
op
::
unsqueeze
{
vec_axises
},
dot_res
);
}
return
dot_res
;
}
...
...
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