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
97108410
Unverified
Commit
97108410
authored
Aug 28, 2019
by
mvermeulen
Committed by
GitHub
Aug 28, 2019
Browse files
Merge pull request #347 from ROCmSoftwarePlatform/parse-indices
Fix dpn crash
parents
015631a1
0dc15ece
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 @
97108410
...
...
@@ -524,15 +524,7 @@ struct onnx_parser
if
(
contains
(
attributes
,
"ends"
))
{
literal
s
=
parse_value
(
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
];
}
}
op
.
ends
=
get_indices
(
attributes
.
at
(
"ends"
));
}
if
(
contains
(
attributes
,
"starts"
))
{
...
...
@@ -1548,6 +1540,20 @@ struct onnx_parser
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
>
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