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
5b41beb8
Commit
5b41beb8
authored
Jul 02, 2019
by
Shucai Xiao
Browse files
clang format
parent
860208db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+17
-13
No files found.
src/onnx/onnx.cpp
View file @
5b41beb8
...
...
@@ -189,12 +189,12 @@ struct onnx_parser
s1
.
begin
()
+
offset
,
out_lens
.
begin
()
+
offset
,
[](
auto
a
,
auto
b
)
{
if
(
a
!=
b
and
a
!=
1
and
b
!=
1
)
if
(
a
!=
b
and
a
!=
1
and
b
!=
1
)
{
MIGRAPHX_THROW
(
"COMPUTE_BROADCASTED_LEN: input shapes mismatch!"
);
}
return
std
::
max
(
a
,
b
);
});
return
std
::
max
(
a
,
b
);
});
return
out_lens
;
}
...
...
@@ -900,13 +900,15 @@ struct onnx_parser
}
}
instruction_ref
parse_constant_of_shape
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
instruction_ref
parse_constant_of_shape
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
literal
l_val
{};
if
(
contains
(
attributes
,
"value"
))
if
(
contains
(
attributes
,
"value"
))
{
l_val
=
parse_value
(
attributes
.
at
(
"value"
));
if
(
l_val
.
get_shape
().
elements
()
!=
1
)
if
(
l_val
.
get_shape
().
elements
()
!=
1
)
{
MIGRAPHX_THROW
(
"ConstantOfShape: attribute value can contain only 1 elements!"
);
}
...
...
@@ -918,7 +920,7 @@ struct onnx_parser
// input is empty, output is a scalar
auto
type
=
l_val
.
get_shape
().
type
();
if
(
args
.
size
()
==
0
)
if
(
args
.
size
()
==
0
)
{
return
prog
.
add_literal
(
literal
({
type
,
{
1
},
{
0
}},
l_val
.
data
()));
}
...
...
@@ -946,10 +948,11 @@ struct onnx_parser
}
}
instruction_ref
parse_expand
(
const
std
::
string
&
,
attribute_map
,
std
::
vector
<
instruction_ref
>
args
)
instruction_ref
parse_expand
(
const
std
::
string
&
,
attribute_map
,
std
::
vector
<
instruction_ref
>
args
)
{
auto
in_lens
=
args
[
0
]
->
get_shape
().
lens
();
auto
ex_lens
=
args
[
1
]
->
get_shape
().
lens
();
auto
in_lens
=
args
[
0
]
->
get_shape
().
lens
();
auto
ex_lens
=
args
[
1
]
->
get_shape
().
lens
();
auto
out_lens
=
compute_broadcasted_lens
(
in_lens
,
ex_lens
);
return
prog
.
add_instruction
(
op
::
multibroadcast
{
out_lens
},
std
::
move
(
args
[
0
]));
...
...
@@ -1377,14 +1380,15 @@ struct onnx_parser
}
}
instruction_ref
parse_cast
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
instruction_ref
parse_cast
(
const
std
::
string
&
,
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
if
(
!
contains
(
attributes
,
"to"
))
if
(
!
contains
(
attributes
,
"to"
))
{
MIGRAPHX_THROW
(
"PARSE_CAST: missing to type attribute!"
);
}
int
to_type
=
parse_value
(
attributes
.
at
(
"to"
)).
at
<
int
>
();
int
to_type
=
parse_value
(
attributes
.
at
(
"to"
)).
at
<
int
>
();
shape
::
type_t
type
=
get_type
(
to_type
);
return
prog
.
add_instruction
(
op
::
convert
{
type
},
std
::
move
(
args
));
}
...
...
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