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
5246b8d7
Commit
5246b8d7
authored
May 16, 2019
by
Shucai Xiao
Browse files
clang format
parent
4e433399
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
src/quantization.cpp
src/quantization.cpp
+14
-11
No files found.
src/quantization.cpp
View file @
5246b8d7
...
...
@@ -104,9 +104,10 @@ void quantize(program& prog, const std::vector<std::string>& ins_names)
void
quantize
(
program
&
prog
)
{
quantize
(
prog
,
{
"all"
});
}
std
::
vector
<
std
::
vector
<
argument
>
>
ins_args
;
void
capture_args
(
std
::
size_t
ins_index
,
std
::
vector
<
argument
>
args
)
{
if
(
ins_index
=
ins_args
.
size
())
std
::
vector
<
std
::
vector
<
argument
>>
ins_args
;
void
capture_args
(
std
::
size_t
ins_index
,
std
::
vector
<
argument
>
args
)
{
if
(
ins_index
=
ins_args
.
size
())
{
ins_args
.
push_back
(
std
::
vector
<
argument
>
{});
}
...
...
@@ -115,7 +116,8 @@ void capture_args(std::size_t ins_index, std::vector<argument> args) {
return
;
}
void
calc_quant_params
(
std
::
vector
<
std
::
vector
<
argument
>>&
ins_arg
,
std
::
vector
<
std
::
pair
<
float
,
float
>>&
ins_params
)
void
calc_quant_params
(
std
::
vector
<
std
::
vector
<
argument
>>&
ins_arg
,
std
::
vector
<
std
::
pair
<
float
,
float
>>&
ins_params
)
{
return
;
}
...
...
@@ -126,9 +128,9 @@ void capture_arguments(program& prog, const std::vector<std::string>& ins_names)
{
// the int8 quantization only support dot and convolution
std
::
vector
<
std
::
string
>
op_names
=
{
"dot"
,
"convolution"
};
if
(
!
std
::
all_of
(
ins_names
.
begin
(),
ins_names
.
end
(),
[
&
](
auto
name
)
{
return
std
::
find
(
op_names
.
begin
(),
op_names
.
end
(),
name
)
!=
op_names
.
end
();
}))
if
(
!
std
::
all_of
(
ins_names
.
begin
(),
ins_names
.
end
(),
[
&
](
auto
name
)
{
return
std
::
find
(
op_names
.
begin
(),
op_names
.
end
(),
name
)
!=
op_names
.
end
();
}))
{
MIGRAPHX_THROW
(
"CAPTURE_ARGUMENTS: input operator is not supported"
);
}
...
...
@@ -137,23 +139,24 @@ void capture_arguments(program& prog, const std::vector<std::string>& ins_names)
std
::
size_t
index
=
0
;
for
(
auto
ins
:
iterator_for
(
prog
))
{
if
(
not
contains
(
ins_names
,
ins
->
name
()))
if
(
not
contains
(
ins_names
,
ins
->
name
()))
{
continue
;
}
auto
inputs
=
ins
->
inputs
();
std
::
vector
<
instruction_ref
>
new_args
;
for
(
auto
input
:
inputs
)
for
(
auto
input
:
inputs
)
{
instruction_ref
new_ins
{};
if
(
ins_map
.
count
(
input
)
>
0
)
if
(
ins_map
.
count
(
input
)
>
0
)
{
new_ins
=
ins_map
[
input
];
}
else
{
new_ins
=
prog
.
insert_instruction
(
std
::
next
(
input
),
op
::
capture
{
index
++
,
capture_args
},
input
);
new_ins
=
prog
.
insert_instruction
(
std
::
next
(
input
),
op
::
capture
{
index
++
,
capture_args
},
input
);
ins_map
[
input
]
=
new_ins
;
}
new_args
.
push_back
(
new_ins
);
...
...
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