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
40595b78
Commit
40595b78
authored
Jun 20, 2018
by
Paul
Browse files
Fix parsing ints
parent
21e88916
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/onnx/read_onnx.cpp
src/onnx/read_onnx.cpp
+9
-5
No files found.
src/onnx/read_onnx.cpp
View file @
40595b78
...
...
@@ -227,6 +227,13 @@ struct onnx_parser
return
result
;
}
template
<
class
T
>
static
rtg
::
literal
from_repeated
(
rtg
::
shape
::
type_t
t
,
const
T
&
r
)
{
std
::
size_t
size
=
r
.
size
();
return
rtg
::
literal
{{
t
,
{
size
}},
r
.
begin
(),
r
.
end
()};
}
static
rtg
::
literal
parse_value
(
const
onnx
::
AttributeProto
&
attr
)
{
switch
(
attr
.
type
())
...
...
@@ -237,11 +244,8 @@ struct onnx_parser
case
onnx
::
AttributeProto
::
STRING
:
return
{};
case
onnx
::
AttributeProto
::
TENSOR
:
return
parse_tensor
(
attr
.
t
());
case
onnx
::
AttributeProto
::
GRAPH
:
return
{};
case
onnx
::
AttributeProto
::
FLOATS
:
return
rtg
::
literal
{
rtg
::
shape
::
float_type
,
attr
.
floats
().
begin
(),
attr
.
floats
().
end
()};
case
onnx
::
AttributeProto
::
INTS
:
return
rtg
::
literal
{
rtg
::
shape
::
int32_type
,
attr
.
ints
().
begin
(),
attr
.
ints
().
end
()};
;
case
onnx
::
AttributeProto
::
FLOATS
:
return
from_repeated
(
rtg
::
shape
::
float_type
,
attr
.
floats
());
case
onnx
::
AttributeProto
::
INTS
:
return
from_repeated
(
rtg
::
shape
::
int64_type
,
attr
.
ints
());
case
onnx
::
AttributeProto
::
STRINGS
:
return
{};
case
onnx
::
AttributeProto
::
TENSORS
:
return
{};
case
onnx
::
AttributeProto
::
GRAPHS
:
return
{};
...
...
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