Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b339dff2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b339dff2
编写于
1月 16, 2020
作者:
J
juncaipeng
提交者:
GitHub
1月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix use cache file, test=develop (#22240)
上级
895f8da7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
11 deletion
+14
-11
python/paddle/fluid/contrib/slim/tests/test_post_training_quantization_mobilenetv1.py
...slim/tests/test_post_training_quantization_mobilenetv1.py
+10
-8
python/paddle/fluid/contrib/slim/tests/test_post_training_quantization_resnet50.py
...ib/slim/tests/test_post_training_quantization_resnet50.py
+4
-3
未找到文件。
python/paddle/fluid/contrib/slim/tests/test_post_training_quantization_mobilenetv1.py
浏览文件 @
b339dff2
...
...
@@ -236,6 +236,7 @@ class TestPostTrainingQuantization(unittest.TestCase):
def
generate_quantized_model
(
self
,
model_path
,
quantizable_op_type
,
algo
=
"KL"
,
is_full_quantize
=
False
,
is_use_cache_file
=
False
):
...
...
@@ -250,9 +251,6 @@ class TestPostTrainingQuantization(unittest.TestCase):
exe
=
fluid
.
Executor
(
place
)
scope
=
fluid
.
global_scope
()
val_reader
=
val
()
quantizable_op_type
=
[
"conv2d"
,
"depthwise_conv2d"
,
"mul"
,
"pool2d"
,
"elementwise_add"
]
ptq
=
PostTrainingQuantization
(
executor
=
exe
,
...
...
@@ -265,8 +263,8 @@ class TestPostTrainingQuantization(unittest.TestCase):
ptq
.
quantize
()
ptq
.
save_quantized_model
(
self
.
int8_model
)
def
run_test
(
self
,
model
,
algo
,
data_urls
,
data_md5s
,
is_full_quantiz
e
,
is_use_cache_file
):
def
run_test
(
self
,
model
,
algo
,
data_urls
,
data_md5s
,
quantizable_op_typ
e
,
is_
full_quantize
,
is_
use_cache_file
):
infer_iterations
=
self
.
infer_iterations
batch_size
=
self
.
batch_size
sample_iterations
=
self
.
sample_iterations
...
...
@@ -280,7 +278,8 @@ class TestPostTrainingQuantization(unittest.TestCase):
print
(
"Start INT8 post training quantization for {0} on {1} images ..."
.
format
(
model
,
sample_iterations
*
batch_size
))
self
.
generate_quantized_model
(
model_cache_folder
+
"/model"
,
algo
,
self
.
generate_quantized_model
(
model_cache_folder
+
"/model"
,
quantizable_op_type
,
algo
,
is_full_quantize
,
is_use_cache_file
)
print
(
"Start INT8 inference for {0} on {1} images ..."
.
format
(
...
...
@@ -308,10 +307,13 @@ class TestPostTrainingForMobilenetv1(TestPostTrainingQuantization):
'http://paddle-inference-dist.bj.bcebos.com/int8/mobilenetv1_int8_model.tar.gz'
]
data_md5s
=
[
'13892b0716d26443a8cdea15b3c6438b'
]
quantizable_op_type
=
[
"conv2d"
,
"depthwise_conv2d"
,
"mul"
,
"pool2d"
,
"elementwise_add"
]
is_full_quantize
=
True
is_use_cache_file
=
False
self
.
run_test
(
model
,
algo
,
data_urls
,
data_md5s
,
is_full_quantiz
e
,
is_use_cache_file
)
self
.
run_test
(
model
,
algo
,
data_urls
,
data_md5s
,
quantizable_op_typ
e
,
is_
full_quantize
,
is_
use_cache_file
)
if
__name__
==
'__main__'
:
...
...
python/paddle/fluid/contrib/slim/tests/test_post_training_quantization_resnet50.py
浏览文件 @
b339dff2
...
...
@@ -25,10 +25,11 @@ class TestPostTrainingForResnet50(TestPostTrainingQuantization):
'http://paddle-inference-dist.bj.bcebos.com/int8/resnet50_int8_model.tar.gz'
]
data_md5s
=
[
'4a5194524823d9b76da6e738e1367881'
]
quantizable_op_type
=
[
"conv2d"
,
"mul"
]
is_full_quantize
=
False
is_use_cache_file
=
Tru
e
self
.
run_test
(
model
,
algo
,
data_urls
,
data_md5s
,
is_full_quantiz
e
,
is_use_cache_file
)
is_use_cache_file
=
Fals
e
self
.
run_test
(
model
,
algo
,
data_urls
,
data_md5s
,
quantizable_op_typ
e
,
is_
full_quantize
,
is_
use_cache_file
)
if
__name__
==
'__main__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录