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
cedfbd88
Commit
cedfbd88
authored
Feb 21, 2019
by
Khalique
Browse files
formatting
parent
d87962f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+4
-3
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+5
-3
No files found.
src/onnx/onnx.cpp
View file @
cedfbd88
...
@@ -1136,9 +1136,10 @@ struct onnx_parser
...
@@ -1136,9 +1136,10 @@ struct onnx_parser
{
{
std
::
vector
<
uint16_t
>
data_uint16
(
t
.
int32_data
().
begin
(),
t
.
int32_data
().
end
());
std
::
vector
<
uint16_t
>
data_uint16
(
t
.
int32_data
().
begin
(),
t
.
int32_data
().
end
());
std
::
vector
<
half
>
data_half
;
std
::
vector
<
half
>
data_half
;
std
::
transform
(
data_uint16
.
begin
(),
data_uint16
.
end
(),
std
::
back_inserter
(
data_half
),
[
&
](
uint16_t
raw_val
){
std
::
transform
(
data_uint16
.
begin
(),
return
*
reinterpret_cast
<
half
*>
(
&
raw_val
);
data_uint16
.
end
(),
});
std
::
back_inserter
(
data_half
),
[
&
](
uint16_t
raw_val
)
{
return
*
reinterpret_cast
<
half
*>
(
&
raw_val
);
});
return
literal
{{
shape
::
half_type
,
dims
},
data_half
.
begin
(),
data_half
.
end
()};
return
literal
{{
shape
::
half_type
,
dims
},
data_half
.
begin
(),
data_half
.
end
()};
}
}
case
onnx
::
TensorProto
::
DOUBLE
:
case
onnx
::
TensorProto
::
DOUBLE
:
...
...
test/onnx/onnx_test.cpp
View file @
cedfbd88
...
@@ -1218,9 +1218,11 @@ TEST_CASE(lrn_test)
...
@@ -1218,9 +1218,11 @@ TEST_CASE(lrn_test)
TEST_CASE
(
add_fp16_test
)
TEST_CASE
(
add_fp16_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
1
}},
{
1.5
}});
auto
l0
=
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
1
}},
{
2.5
}});
p
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
1
}},
{
1.5
}});
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
1
}},
{
2.5
}});
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
l1
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
l1
);
auto
prog
=
migraphx
::
parse_onnx
(
"add_fp16_test.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"add_fp16_test.onnx"
);
...
...
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