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
019dc896
Commit
019dc896
authored
Aug 30, 2019
by
Shucai Xiao
Browse files
clang format
parent
e0646252
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
31 deletions
+31
-31
src/quantization.cpp
src/quantization.cpp
+8
-7
test/quantization.cpp
test/quantization.cpp
+23
-24
No files found.
src/quantization.cpp
View file @
019dc896
...
...
@@ -261,7 +261,8 @@ static void ins_quantize_int8(program& prog,
auto
dilation
=
conv_op
.
dilation
;
auto
padding_mode
=
conv_op
.
padding_mode
;
auto
group
=
conv_op
.
group
;
auto
adjust_factor
=
std
::
round
(
1.0
f
/
(
ins_quant_params
[
0
].
first
*
ins_quant_params
[
1
].
first
));
auto
adjust_factor
=
std
::
round
(
1.0
f
/
(
ins_quant_params
[
0
].
first
*
ins_quant_params
[
1
].
first
));
auto
quant_conv
=
prog
.
insert_instruction
(
ins
,
...
...
test/quantization.cpp
View file @
019dc896
...
...
@@ -585,8 +585,7 @@ TEST_CASE(dot_int32)
TEST_CASE
(
conv_float
)
{
auto
create_program
=
[]
{
auto
create_program
=
[]
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
,
3
,
3
}});
...
...
@@ -640,8 +639,7 @@ TEST_CASE(conv_float)
TEST_CASE
(
conv_int32
)
{
auto
create_program
=
[]
{
auto
create_program
=
[]
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
4
,
3
,
3
,
3
}});
...
...
@@ -669,7 +667,8 @@ TEST_CASE(conv_int32)
// quantize parameter b to int8 type
auto
insert_loc
=
std
::
next
(
pw
);
auto
fpw
=
p
.
insert_instruction
(
insert_loc
,
migraphx
::
op
::
convert
{
migraphx
::
shape
::
float_type
},
pw
);
auto
fpw
=
p
.
insert_instruction
(
insert_loc
,
migraphx
::
op
::
convert
{
migraphx
::
shape
::
float_type
},
pw
);
std
::
vector
<
float
>
vfw
(
sw
.
elements
(),
0.1
f
);
auto
fw
=
p
.
add_literal
(
migraphx
::
literal
(
fpw
->
get_shape
(),
vfw
));
auto
mw
=
p
.
insert_instruction
(
insert_loc
,
migraphx
::
op
::
mul
{},
fw
,
fpw
);
...
...
@@ -696,8 +695,7 @@ TEST_CASE(conv_int32)
TEST_CASE
(
conv_half
)
{
auto
create_program
=
[]
{
auto
create_program
=
[]
{
migraphx
::
program
p
;
auto
input
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
4
,
3
,
3
,
3
}});
...
...
@@ -725,7 +723,8 @@ TEST_CASE(conv_half)
// quantize parameter b to int8 type
auto
insert_loc
=
std
::
next
(
pw
);
auto
fpw
=
p
.
insert_instruction
(
insert_loc
,
migraphx
::
op
::
convert
{
migraphx
::
shape
::
float_type
},
pw
);
auto
fpw
=
p
.
insert_instruction
(
insert_loc
,
migraphx
::
op
::
convert
{
migraphx
::
shape
::
float_type
},
pw
);
std
::
vector
<
float
>
vfw
(
sw
.
elements
(),
0.1
f
);
auto
fw
=
p
.
add_literal
(
migraphx
::
literal
(
fpw
->
get_shape
(),
vfw
));
auto
mw
=
p
.
insert_instruction
(
insert_loc
,
migraphx
::
op
::
mul
{},
fw
,
fpw
);
...
...
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