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
71276f4d
Commit
71276f4d
authored
Nov 26, 2018
by
Khalique
Browse files
initial progress
parent
c58ce6f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+25
-11
No files found.
src/onnx/onnx.cpp
View file @
71276f4d
...
@@ -137,22 +137,36 @@ struct onnx_parser
...
@@ -137,22 +137,36 @@ struct onnx_parser
const
std
::
vector
<
std
::
size_t
>*
s0
=
&
args
[
0
]
->
get_shape
().
lens
();
const
std
::
vector
<
std
::
size_t
>*
s0
=
&
args
[
0
]
->
get_shape
().
lens
();
const
std
::
vector
<
std
::
size_t
>*
s1
=
&
args
[
1
]
->
get_shape
().
lens
();
const
std
::
vector
<
std
::
size_t
>*
s1
=
&
args
[
1
]
->
get_shape
().
lens
();
bool
swapped
=
false
;
// Make sure s0 is the smaller size
// Make sure s0 is the smaller size
if
(
s0
->
size
()
>
s1
->
size
())
if
(
s0
->
size
()
>
s1
->
size
())
{
std
::
swap
(
s0
,
s1
);
std
::
swap
(
s0
,
s1
);
swapped
=
true
;
}
// Copy the larger vector to output_lens
std
::
vector
<
std
::
size_t
>
output_lens
(
s1
->
size
());
std
::
vector
<
std
::
size_t
>
output_lens
(
s1
->
size
());
auto
offset
=
s1
->
size
()
-
s0
->
size
();
// if (s0->size() == 0)
std
::
transform
(
s0
->
begin
(),
// {
s0
->
end
(),
// shape s = swapped ? args[0]->get_shape() : args[1]->get_shape();
s1
->
begin
()
+
offset
,
// auto l0 = prog.add_instruction(migraphx::op::scalar{s}, 1.0f);
output_lens
.
begin
()
+
offset
,
// return prog.add_instruction(x, l0, args[1]);
[](
auto
a
,
auto
b
)
{
return
std
::
max
(
a
,
b
);
});
// }
// else
auto
l0
=
prog
.
add_instruction
(
op
::
multibroadcast
{
output_lens
},
args
[
0
]);
// {
auto
l1
=
prog
.
add_instruction
(
op
::
multibroadcast
{
output_lens
},
args
[
1
]);
// Copy the larger vector to output_lens
return
prog
.
add_instruction
(
x
,
l0
,
l1
);
auto
offset
=
s1
->
size
()
-
s0
->
size
();
std
::
transform
(
s0
->
begin
(),
s0
->
end
(),
s1
->
begin
()
+
offset
,
output_lens
.
begin
()
+
offset
,
[](
auto
a
,
auto
b
)
{
return
std
::
max
(
a
,
b
);
});
auto
l0
=
prog
.
add_instruction
(
op
::
multibroadcast
{
output_lens
},
args
[
0
]);
auto
l1
=
prog
.
add_instruction
(
op
::
multibroadcast
{
output_lens
},
args
[
1
]);
return
prog
.
add_instruction
(
x
,
l0
,
l1
);
// }
}
}
else
else
{
{
...
...
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