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
4e673ca3
Commit
4e673ca3
authored
Apr 10, 2019
by
Shucai Xiao
Browse files
change to simplify the type conversion for literals
parent
28edb6fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
src/quantization.cpp
src/quantization.cpp
+11
-4
No files found.
src/quantization.cpp
View file @
4e673ca3
...
@@ -24,11 +24,18 @@ instruction_ref convert_fp32_fp16(program& prog, instruction_ref& ins)
...
@@ -24,11 +24,18 @@ instruction_ref convert_fp32_fp16(program& prog, instruction_ref& ins)
instruction_ref
ins_fp16
{};
instruction_ref
ins_fp16
{};
if
(
ins
->
name
()
==
"@literal"
)
if
(
ins
->
name
()
==
"@literal"
)
{
{
std
::
vector
<
float
>
values
;
auto
l_fp32
=
ins
->
get_literal
();
shape
s
=
ins
->
get_shape
();
shape
s
=
ins
->
get_shape
();
l_fp32
.
visit
([
&
](
auto
val
)
{
values
.
assign
(
val
.
begin
(),
val
.
end
());
});
auto
l
=
ins
->
get_literal
();
ins_fp16
=
prog
.
add_literal
(
literal
({
shape
::
half_type
,
s
.
lens
()},
values
));
if
(
s
.
type
()
==
shape
::
float_type
)
{
auto
tv
=
l
.
get
<
const
float
>
();
ins_fp16
=
prog
.
add_literal
(
literal
({
shape
::
half_type
,
s
.
lens
()},
tv
.
begin
(),
tv
.
end
()));
}
else
{
auto
tv
=
l
.
get
<
const
double
>
();
ins_fp16
=
prog
.
add_literal
(
literal
({
shape
::
half_type
,
s
.
lens
()},
tv
.
begin
(),
tv
.
end
()));
}
}
}
else
if
(
ins
->
name
()
==
"@param"
)
else
if
(
ins
->
name
()
==
"@param"
)
{
{
...
...
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