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
c0640134
Unverified
Commit
c0640134
authored
Aug 29, 2019
by
Paul Fultz II
Committed by
GitHub
Aug 29, 2019
Browse files
Merge branch 'develop' into cse-fix
parents
1290f3ba
97108410
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+15
-9
No files found.
src/onnx/onnx.cpp
View file @
c0640134
...
@@ -524,15 +524,7 @@ struct onnx_parser
...
@@ -524,15 +524,7 @@ struct onnx_parser
if
(
contains
(
attributes
,
"ends"
))
if
(
contains
(
attributes
,
"ends"
))
{
{
literal
s
=
parse_value
(
attributes
.
at
(
"ends"
));
op
.
ends
=
get_indices
(
attributes
.
at
(
"ends"
));
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
op
.
ends
));
});
for
(
size_t
i
=
0
;
i
<
num_dims
;
i
++
)
{
if
(
static_cast
<
size_t
>
(
op
.
ends
[
i
])
>
dims
[
i
])
{
op
.
ends
[
i
]
=
dims
[
i
];
}
}
}
}
if
(
contains
(
attributes
,
"starts"
))
if
(
contains
(
attributes
,
"starts"
))
{
{
...
@@ -1548,6 +1540,20 @@ struct onnx_parser
...
@@ -1548,6 +1540,20 @@ struct onnx_parser
return
result
;
return
result
;
}
}
static
std
::
vector
<
int64_t
>
get_indices
(
const
onnx
::
AttributeProto
&
attr
)
{
std
::
vector
<
int64_t
>
result
;
literal
s
=
parse_value
(
attr
);
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
result
));
});
// Clamp large indices to -1
std
::
replace_if
(
result
.
begin
(),
result
.
end
(),
[](
auto
x
)
{
return
x
>
int64_t
{
std
::
numeric_limits
<
std
::
int32_t
>::
max
()}
/
2
;
},
-
1
);
return
result
;
}
template
<
class
T
>
template
<
class
T
>
static
literal
from_repeated
(
shape
::
type_t
t
,
const
T
&
r
)
static
literal
from_repeated
(
shape
::
type_t
t
,
const
T
&
r
)
{
{
...
...
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