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
48b27a7f
"example/17_convnd_bwd_data/README.md" did not exist on "cd167e492a8f85ec6f5965e50667e8a58d3aa3a1"
Commit
48b27a7f
authored
Sep 03, 2019
by
Shucai Xiao
Browse files
add an env variable to print out the quantization parameter
parent
69da37bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
src/include/migraphx/quantization.hpp
src/include/migraphx/quantization.hpp
+3
-0
src/quantization.cpp
src/quantization.cpp
+9
-0
No files found.
src/include/migraphx/quantization.hpp
View file @
48b27a7f
...
@@ -8,12 +8,15 @@
...
@@ -8,12 +8,15 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/target.hpp>
#include <migraphx/target.hpp>
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/env.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
struct
program
;
struct
program
;
MIGRAPHX_DECLARE_ENV_VAR
(
MIGRAPHX_INT8_QUANTIZATION_PARAMS
)
void
quantize_fp16
(
program
&
prog
,
const
std
::
vector
<
std
::
string
>&
ins_names
);
void
quantize_fp16
(
program
&
prog
,
const
std
::
vector
<
std
::
string
>&
ins_names
);
void
quantize_fp16
(
program
&
prog
);
void
quantize_fp16
(
program
&
prog
);
...
...
src/quantization.cpp
View file @
48b27a7f
...
@@ -309,6 +309,15 @@ void quantize_int8(program& prog,
...
@@ -309,6 +309,15 @@ void quantize_int8(program& prog,
const
std
::
vector
<
std
::
pair
<
float
,
float
>>&
quant_params
,
const
std
::
vector
<
std
::
pair
<
float
,
float
>>&
quant_params
,
const
std
::
vector
<
std
::
string
>&
ins_names
)
const
std
::
vector
<
std
::
string
>&
ins_names
)
{
{
if
(
enabled
(
MIGRAPHX_INT8_QUANTIZATION_PARAMS
{}))
{
for
(
std
::
size_t
i
=
0
;
i
<
quant_params
.
size
();
++
i
)
{
auto
param
=
quant_params
.
at
(
i
);
std
::
cout
<<
"ins_index = "
<<
i
<<
", scale = "
<<
param
.
first
<<
", shift = "
<<
param
.
second
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
}
// 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
::
vector
<
std
::
string
>
op_names
=
{
"dot"
,
"convolution"
};
std
::
vector
<
std
::
string
>
op_names
=
{
"dot"
,
"convolution"
};
if
(
!
std
::
all_of
(
ins_names
.
begin
(),
ins_names
.
end
(),
[
&
](
auto
name
)
{
if
(
!
std
::
all_of
(
ins_names
.
begin
(),
ins_names
.
end
(),
[
&
](
auto
name
)
{
...
...
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