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
2bd42086
Commit
2bd42086
authored
Aug 27, 2019
by
Paul
Browse files
Fix dpn error
parent
a1c7e7a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+13
-9
No files found.
src/onnx/onnx.cpp
View file @
2bd42086
...
@@ -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,18 @@ struct onnx_parser
...
@@ -1548,6 +1540,18 @@ 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
for
(
auto
&&
x
:
result
)
if
(
x
>
int64_t
{
std
::
numeric_limits
<
std
::
int32_t
>::
max
()}
/
2
)
x
=
-
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