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
881665a8
Commit
881665a8
authored
Aug 08, 2019
by
Shucai Xiao
Browse files
clang format'
parent
5447f39c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/quantization.cpp
src/quantization.cpp
+9
-8
No files found.
src/quantization.cpp
View file @
881665a8
...
...
@@ -300,11 +300,12 @@ void quantize_int8(program& prog,
// relative rounding error
else
{
auto
q_dot
=
prog
.
insert_instruction
(
ins
,
op
::
quant_dot
{
1
,
0
},
converted_inputs
);
auto
f_dot
=
prog
.
insert_instruction
(
ins
,
op
::
convert
{
shape
::
float_type
},
q_dot
);
auto
c_shape
=
q_dot
->
get_shape
();
auto
q_dot
=
prog
.
insert_instruction
(
ins
,
op
::
quant_dot
{
1
,
0
},
converted_inputs
);
auto
f_dot
=
prog
.
insert_instruction
(
ins
,
op
::
convert
{
shape
::
float_type
},
q_dot
);
auto
c_shape
=
q_dot
->
get_shape
();
std
::
vector
<
float
>
vec_alpha
(
c_shape
.
elements
(),
new_alpha
);
auto
l_alpha
=
prog
.
add_literal
(
literal
({
shape
::
float_type
,
c_shape
.
lens
()},
vec_alpha
));
auto
l_alpha
=
prog
.
add_literal
(
literal
({
shape
::
float_type
,
c_shape
.
lens
()},
vec_alpha
));
if
(
inputs
.
size
()
==
3
and
dot_op
.
beta
!=
0.0
f
)
{
...
...
@@ -325,7 +326,7 @@ void quantize_int8(program& prog,
beta_c
=
prog
.
insert_instruction
(
ins
,
op
::
mul
{},
l_beta
,
inputs
.
back
());
}
if
(
orig_type
==
shape
::
float_type
)
if
(
orig_type
==
shape
::
float_type
)
{
prog
.
replace_instruction
(
ins
,
op
::
add
{},
alpha_ab
,
beta_c
);
}
...
...
@@ -333,18 +334,18 @@ void quantize_int8(program& prog,
{
auto
f_res
=
prog
.
insert_instruction
(
ins
,
op
::
add
{},
alpha_ab
,
beta_c
);
prog
.
replace_instruction
(
ins
,
op
::
convert
{
orig_type
},
f_res
);
}
}
}
else
{
if
(
orig_type
==
shape
::
float_type
)
if
(
orig_type
==
shape
::
float_type
)
{
prog
.
replace_instruction
(
ins
,
op
::
mul
{},
l_alpha
,
f_dot
);
}
else
{
auto
alpha_ab
=
prog
.
insert_instruction
(
ins
,
op
::
mul
{},
l_alpha
,
f_dot
);
prog
.
replace_instruction
(
ins
,
op
::
convert
{
orig_type
},
alpha_ab
);
prog
.
replace_instruction
(
ins
,
op
::
convert
{
orig_type
},
alpha_ab
);
}
}
}
...
...
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