Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
efd73d5c
Commit
efd73d5c
authored
Sep 03, 2019
by
Shucai Xiao
Browse files
clang format
parent
684d5a4e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
src/include/migraphx/quantization.hpp
src/include/migraphx/quantization.hpp
+4
-4
src/py/migraphx_py.cpp
src/py/migraphx_py.cpp
+10
-3
src/quantization.cpp
src/quantization.cpp
+6
-4
No files found.
src/include/migraphx/quantization.hpp
View file @
efd73d5c
...
@@ -27,8 +27,8 @@ std::shared_ptr<std::vector<std::pair<float, float>>>
...
@@ -27,8 +27,8 @@ std::shared_ptr<std::vector<std::pair<float, float>>>
capture_arguments_impl
(
program
&
prog
,
const
target
&
t
,
const
std
::
vector
<
std
::
string
>&
ins_names
);
capture_arguments_impl
(
program
&
prog
,
const
target
&
t
,
const
std
::
vector
<
std
::
string
>&
ins_names
);
template
<
class
T
>
template
<
class
T
>
std
::
shared_ptr
<
std
::
vector
<
std
::
pair
<
float
,
float
>>>
capture_arguments
(
std
::
shared_ptr
<
std
::
vector
<
std
::
pair
<
float
,
float
>>>
program
&
prog
,
T
&&
t
,
const
std
::
vector
<
std
::
string
>&
ins_names
)
capture_arguments
(
program
&
prog
,
T
&&
t
,
const
std
::
vector
<
std
::
string
>&
ins_names
)
{
{
static_assert
(
std
::
is_same
<
std
::
remove_cv_t
<
std
::
remove_reference_t
<
T
>>
,
target
>
{}
&&
static_assert
(
std
::
is_same
<
std
::
remove_cv_t
<
std
::
remove_reference_t
<
T
>>
,
target
>
{}
&&
std
::
is_lvalue_reference
<
T
>
{},
std
::
is_lvalue_reference
<
T
>
{},
...
...
src/py/migraphx_py.cpp
View file @
efd73d5c
...
@@ -183,8 +183,15 @@ PYBIND11_MODULE(migraphx, m)
...
@@ -183,8 +183,15 @@ PYBIND11_MODULE(migraphx, m)
});
});
m
.
def
(
"generate_argument"
,
&
migraphx
::
generate_argument
,
py
::
arg
(
"s"
),
py
::
arg
(
"seed"
)
=
0
);
m
.
def
(
"generate_argument"
,
&
migraphx
::
generate_argument
,
py
::
arg
(
"s"
),
py
::
arg
(
"seed"
)
=
0
);
m
.
def
(
"quantize_fp16"
,
&
migraphx
::
quantize_fp16
,
py
::
arg
(
"prog"
),
py
::
arg
(
"ins_names"
)
=
std
::
vector
<
std
::
string
>
{
"all"
});
m
.
def
(
"quantize_fp16"
,
m
.
def
(
"quantize_int8"
,
&
migraphx
::
quantize_int8
,
py
::
arg
(
"prog"
),
py
::
arg
(
"t"
),
py
::
arg
(
"calibration"
)
=
std
::
vector
<
migraphx
::
program
::
parameter_map
>
{},
&
migraphx
::
quantize_fp16
,
py
::
arg
(
"prog"
),
py
::
arg
(
"ins_names"
)
=
std
::
vector
<
std
::
string
>
{
"all"
});
m
.
def
(
"quantize_int8"
,
&
migraphx
::
quantize_int8
,
py
::
arg
(
"prog"
),
py
::
arg
(
"t"
),
py
::
arg
(
"calibration"
)
=
std
::
vector
<
migraphx
::
program
::
parameter_map
>
{},
py
::
arg
(
"ins_names"
)
=
std
::
vector
<
std
::
string
>
{
"dot"
,
"convolution"
});
py
::
arg
(
"ins_names"
)
=
std
::
vector
<
std
::
string
>
{
"dot"
,
"convolution"
});
#ifdef HAVE_GPU
#ifdef HAVE_GPU
...
...
src/quantization.cpp
View file @
efd73d5c
...
@@ -325,7 +325,8 @@ void quantize_int8_impl(program& prog,
...
@@ -325,7 +325,8 @@ void quantize_int8_impl(program& prog,
// For now, we only support the int8 quantization of gemm and convolution
// For now, we only support the int8 quantization of gemm and convolution
std
::
set
<
std
::
string
>
op_names
=
{
"convolution"
,
"dot"
};
std
::
set
<
std
::
string
>
op_names
=
{
"convolution"
,
"dot"
};
std
::
set
<
std
::
string
>
input_ins_names
(
ins_names
.
begin
(),
ins_names
.
end
());
std
::
set
<
std
::
string
>
input_ins_names
(
ins_names
.
begin
(),
ins_names
.
end
());
if
(
!
std
::
includes
(
op_names
.
begin
(),
op_names
.
end
(),
input_ins_names
.
begin
(),
input_ins_names
.
end
()))
if
(
!
std
::
includes
(
op_names
.
begin
(),
op_names
.
end
(),
input_ins_names
.
begin
(),
input_ins_names
.
end
()))
{
{
MIGRAPHX_THROW
(
"QUANTIZE_INT8: only support DOT and CONVOLUTION operation"
);
MIGRAPHX_THROW
(
"QUANTIZE_INT8: only support DOT and CONVOLUTION operation"
);
}
}
...
@@ -458,7 +459,8 @@ std::size_t capture_arguments(program& prog,
...
@@ -458,7 +459,8 @@ std::size_t capture_arguments(program& prog,
// the int8 quantization only support dot and convolution
// the int8 quantization only support dot and convolution
std
::
vector
<
std
::
string
>
op_names
=
{
"dot"
,
"convolution"
};
std
::
vector
<
std
::
string
>
op_names
=
{
"dot"
,
"convolution"
};
std
::
set
<
std
::
string
>
input_ins_names
(
ins_names
.
begin
(),
ins_names
.
end
());
std
::
set
<
std
::
string
>
input_ins_names
(
ins_names
.
begin
(),
ins_names
.
end
());
if
(
!
std
::
includes
(
op_names
.
begin
(),
op_names
.
end
(),
input_ins_names
.
begin
(),
input_ins_names
.
end
()))
if
(
!
std
::
includes
(
op_names
.
begin
(),
op_names
.
end
(),
input_ins_names
.
begin
(),
input_ins_names
.
end
()))
{
{
MIGRAPHX_THROW
(
"CAPTURE_ARGUMENTS: input operator is not supported"
);
MIGRAPHX_THROW
(
"CAPTURE_ARGUMENTS: input operator is not supported"
);
}
}
...
...
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