Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
ce4dc254
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
1 年多 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ce4dc254
编写于
2月 03, 2020
作者:
W
wanghaoshuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deployed
44b48c82
with MkDocs version: 1.0.4
上级
da29a449
变更
24
展开全部
隐藏空白更改
内联
并排
Showing
24 changed file
with
521 addition
and
127 deletion
+521
-127
404.html
404.html
+4
-0
algo/algo/index.html
algo/algo/index.html
+4
-0
api/analysis_api/index.html
api/analysis_api/index.html
+16
-12
api/api_guide/index.html
api/api_guide/index.html
+4
-0
api/nas_api/index.html
api/nas_api/index.html
+13
-9
api/prune_api/index.html
api/prune_api/index.html
+25
-21
api/quantization_api/index.html
api/quantization_api/index.html
+25
-21
api/single_distiller_api/index.html
api/single_distiller_api/index.html
+19
-15
index.html
index.html
+5
-1
model_zoo/index.html
model_zoo/index.html
+6
-2
search.html
search.html
+4
-0
search/search_index.json
search/search_index.json
+1
-1
search_space/index.html
search_space/index.html
+12
-8
sitemap.xml
sitemap.xml
+20
-15
sitemap.xml.gz
sitemap.xml.gz
+0
-0
table_latency/index.html
table_latency/index.html
+4
-0
tutorials/demo_guide/index.html
tutorials/demo_guide/index.html
+4
-0
tutorials/distillation_demo/index.html
tutorials/distillation_demo/index.html
+11
-7
tutorials/nas_demo/index.html
tutorials/nas_demo/index.html
+10
-6
tutorials/pruning_tutorial/index.html
tutorials/pruning_tutorial/index.html
+309
-0
tutorials/quant_aware_demo/index.html
tutorials/quant_aware_demo/index.html
+11
-7
tutorials/quant_embedding_demo/index.html
tutorials/quant_embedding_demo/index.html
+4
-0
tutorials/quant_post_demo/index.html
tutorials/quant_post_demo/index.html
+6
-2
tutorials/sensitivity_demo/index.html
tutorials/sensitivity_demo/index.html
+4
-0
未找到文件。
404.html
浏览文件 @
ce4dc254
...
...
@@ -58,6 +58,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"/tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"/tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
algo/algo/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
api/analysis_api/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -206,7 +210,7 @@
</li>
</ul>
<p><strong>
示例:
</strong></p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddle.fluid.param_attr
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
ParamAttr
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.analysis
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
flops
</span>
...
...
@@ -216,7 +220,7 @@
<span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
groups
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
conv
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
conv2d
</span><span
class=
"p"
>
(
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
num_filters
</span><span
class=
"p"
>
,
</span>
...
...
@@ -224,9 +228,9 @@
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
padding
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
filter_size
</span>
<span
class=
"o"
>
-
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
)
</span>
<span
class=
"o"
>
//
</span>
<span
class=
"mi"
>
2
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
groups
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
groups
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
param_attr
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
ParamAttr
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s2"
>
"
_weights
"
</span><span
class=
"p"
>
),
</span>
<span
class=
"n"
>
bias_attr
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
bias_attr
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s2"
>
"
_out
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
bn_name
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s2"
>
"
_bn
"
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
batch_norm
</span><span
class=
"p"
>
(
</span>
...
...
@@ -248,7 +252,7 @@
<span
class=
"c1"
>
# X: prune output channels
</span>
<span
class=
"c1"
>
# O: prune input channels
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
main_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
startup_program
</span><span
class=
"p"
>
):
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
image
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
])
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
image
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
])
</span>
<span
class=
"n"
>
conv1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv1
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
conv2
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
conv1
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv2
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
sum1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv1
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"n"
>
conv2
</span>
...
...
@@ -258,7 +262,7 @@
<span
class=
"n"
>
conv5
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
sum2
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv5
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
conv6
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
conv5
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv6
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"
k"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
FLOPs: {}
"
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
flops
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
main_program
</span><span
class=
"p"
>
)))
</span>
<span
class=
"
nb"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
FLOPs:
</span><span
class=
"si"
>
{}
</span><span
class=
"s2"
>
"
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
flops
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
main_program
</span><span
class=
"p"
>
)))
</span>
</pre></div>
<h2
id=
"model_size"
>
model_size
<a
class=
"headerlink"
href=
"#model_size"
title=
"Permanent link"
>
#
</a></h2>
...
...
@@ -273,7 +277,7 @@
<li><strong>
model_size(int)
</strong>
- 整个网络的参数数量。
</li>
</ul>
<p><strong>
示例:
</strong></p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddle.fluid.param_attr
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
ParamAttr
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.analysis
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
model_size
</span>
...
...
@@ -283,7 +287,7 @@
<span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
groups
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
conv
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
conv2d
</span><span
class=
"p"
>
(
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
num_filters
</span><span
class=
"p"
>
,
</span>
...
...
@@ -291,9 +295,9 @@
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
padding
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
filter_size
</span>
<span
class=
"o"
>
-
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
)
</span>
<span
class=
"o"
>
//
</span>
<span
class=
"mi"
>
2
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
groups
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
groups
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
param_attr
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
ParamAttr
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s2"
>
"
_weights
"
</span><span
class=
"p"
>
),
</span>
<span
class=
"n"
>
bias_attr
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
bias_attr
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s2"
>
"
_out
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"n"
>
conv
</span>
...
...
@@ -307,7 +311,7 @@
<span
class=
"c1"
>
# X: prune output channels
</span>
<span
class=
"c1"
>
# O: prune input channels
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
main_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
startup_program
</span><span
class=
"p"
>
):
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
image
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
])
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
image
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
16
</span><span
class=
"p"
>
])
</span>
<span
class=
"n"
>
conv1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv1
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
conv2
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
conv1
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv2
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
sum1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv1
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"n"
>
conv2
</span>
...
...
@@ -317,7 +321,7 @@
<span
class=
"n"
>
conv5
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
sum2
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv5
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
conv6
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
conv_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
conv5
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
8
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"s2"
>
"
conv6
"
</span><span
class=
"p"
>
)
</span>
<span
class=
"
k"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
FLOPs: {}
"
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
model_size
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
main_program
</span><span
class=
"p"
>
)))
</span>
<span
class=
"
nb"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
FLOPs:
</span><span
class=
"si"
>
{}
</span><span
class=
"s2"
>
"
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
model_size
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
main_program
</span><span
class=
"p"
>
)))
</span>
</pre></div>
<h2
id=
"tablelatencyevaluator"
>
TableLatencyEvaluator
<a
class=
"headerlink"
href=
"#tablelatencyevaluator"
title=
"Permanent link"
>
#
</a></h2>
...
...
api/api_guide/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
api/nas_api/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -236,16 +240,16 @@
<p><strong>
返回:
</strong>
返回模型结构实例的列表,形式为list。
</p>
<p><strong>
示例代码:
</strong>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.nas
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
SANAS
</span>
<span
class=
"n"
>
config
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[(
</span><span
class=
"s1"
>
'
MobileNetV2Space
'
</span><span
class=
"p"
>
)]
</span>
<span
class=
"n"
>
sanas
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
SANAS
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
configs
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
config
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
input
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
input
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
archs
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
sanas
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
next_archs
</span><span
class=
"p"
>
()
</span>
<span
class=
"k"
>
for
</span>
<span
class=
"n"
>
arch
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"n"
>
archs
</span><span
class=
"p"
>
:
</span>
<span
class=
"n"
>
output
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
arch
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
output
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
output
</span><span
class=
"p"
>
)
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
output
</span><span
class=
"p"
>
)
</span>
</pre></div></p>
<dl>
<dt>
paddleslim.nas.SANAS.reward(score)
</dt>
...
...
@@ -258,7 +262,7 @@
<p><strong>
返回:
</strong>
模型结构更新成功或者失败,成功则返回
<code>
True
</code>
,失败则返回
<code>
False
</code>
。
</p>
<p><strong>
示例代码:
</strong>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.nas
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
SANAS
</span>
<span
class=
"n"
>
config
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[(
</span><span
class=
"s1"
>
'
MobileNetV2Space
'
</span><span
class=
"p"
>
)]
</span>
<span
class=
"n"
>
sanas
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
SANAS
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
configs
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
config
</span><span
class=
"p"
>
)
</span>
...
...
@@ -279,14 +283,14 @@
<p><strong>
返回:
</strong>
根据传入的token得到一个模型结构实例。
</p>
<p><strong>
示例代码:
</strong>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.nas
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
SANAS
</span>
<span
class=
"n"
>
config
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[(
</span><span
class=
"s1"
>
'
MobileNetV2Space
'
</span><span
class=
"p"
>
)]
</span>
<span
class=
"n"
>
sanas
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
SANAS
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
configs
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
config
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
input
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
input
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
tokens
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
([
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
]
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"mi"
>
25
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
archs
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
sanas
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
tokens2arch
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
tokens
</span><span
class=
"p"
>
)[
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
]
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
archs
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
))
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
archs
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
))
</span>
</pre></div></p>
<dl>
<dt>
paddleslim.nas.SANAS.current_info()
</dt>
...
...
@@ -295,11 +299,11 @@
<p><strong>
返回:
</strong>
搜索过程中最好的token,reward和当前训练的token,形式为dict。
</p>
<p><strong>
示例代码:
</strong>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.nas
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
SANAS
</span>
<span
class=
"n"
>
config
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[(
</span><span
class=
"s1"
>
'
MobileNetV2Space
'
</span><span
class=
"p"
>
)]
</span>
<span
class=
"n"
>
sanas
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
SANAS
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
configs
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
config
</span><span
class=
"p"
>
)
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
sanas
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
current_info
</span><span
class=
"p"
>
())
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
sanas
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
current_info
</span><span
class=
"p"
>
())
</span>
</pre></div></p>
</div>
...
...
api/prune_api/index.html
浏览文件 @
ce4dc254
此差异已折叠。
点击以展开。
api/quantization_api/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -219,9 +223,9 @@
<span
class=
"c1"
>
# The decay coefficient of moving average, default is 0.9
</span>
<span
class=
"s1"
>
'
moving_rate
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"mf"
>
0.9
</span><span
class=
"p"
>
,
</span>
<span
class=
"c1"
>
# if True,
'
quantize_op_types
'
will be TENSORRT_OP_TYPES
</span>
<span
class=
"s1"
>
'
for_tensorrt
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"
bp
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"s1"
>
'
for_tensorrt
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"
kc
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"c1"
>
# if True,
'
quantoze_op_types
'
will be TRANSFORM_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES
</span>
<span
class=
"s1"
>
'
is_full_quantize
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"
bp
"
>
False
</span>
<span
class=
"s1"
>
'
is_full_quantize
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"
kc
"
>
False
</span>
<span
class=
"p"
>
}
</span>
</pre></div>
...
...
@@ -300,36 +304,36 @@
<p>
因为该接口会对
<code>
op
</code>
和
<code>
Variable
</code>
做相应的删除和修改,所以此接口只能在训练完成之后调用。如果想转化训练的中间模型,可加载相应的参数之后再使用此接口。
</p>
<p><strong>
代码示例
</strong></p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"c1"
>
#encoding=utf8
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddleslim.quant
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
quant
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddleslim.quant
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
quant
</span>
<span
class=
"n"
>
train_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Program
</span><span
class=
"p"
>
()
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_program
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
image
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
x
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
28
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
28
</span><span
class=
"p"
>
])
</span>
<span
class=
"n"
>
label
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
label
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
image
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
x
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
28
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
28
</span><span
class=
"p"
>
])
</span>
<span
class=
"n"
>
label
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
label
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
conv
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
conv2d
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
image
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
feat
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
fc
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
conv
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
10
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
softmax
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
cost
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
cross_entropy
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
feat
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
label
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
label
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
avg_cost
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
mean
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
x
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
cost
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
True
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
True
</span>
<span
class=
"n"
>
place
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CUDAPlace
</span><span
class=
"p"
>
(
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"k"
>
else
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CPUPlace
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
exe
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Executor
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
place
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
exe
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
run
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
default_startup_program
</span><span
class=
"p"
>
())
</span>
<span
class=
"n"
>
eval_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
clone
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
eval_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
clone
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"c1"
>
#配置
</span>
<span
class=
"n"
>
config
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
{
</span><span
class=
"s1"
>
'
weight_quantize_type
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"s1"
>
'
abs_max
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"s1"
>
'
activation_quantize_type
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"s1"
>
'
moving_average_abs_max
'
</span><span
class=
"p"
>
}
</span>
<span
class=
"n"
>
build_strategy
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
BuildStrategy
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
exec_strategy
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
ExecutionStrategy
</span><span
class=
"p"
>
()
</span>
<span
class=
"c1"
>
#调用api
</span>
<span
class=
"hll"
><span
class=
"n"
>
quant_train_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
False
</span><span
class=
"p"
>
)
</span>
</span><span
class=
"hll"
><span
class=
"n"
>
quant_eval_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
eval_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"hll"
><span
class=
"n"
>
quant_train_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
False
</span><span
class=
"p"
>
)
</span>
</span><span
class=
"hll"
><span
class=
"n"
>
quant_eval_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
eval_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
True
</span><span
class=
"p"
>
)
</span>
</span><span
class=
"c1"
>
#关闭策略
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
fuse_all_reduce_ops
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
False
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
sync_batch_norm
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
False
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
fuse_all_reduce_ops
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
False
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
sync_batch_norm
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
False
</span>
<span
class=
"n"
>
quant_train_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant_train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
with_data_parallel
</span><span
class=
"p"
>
(
</span>
<span
class=
"n"
>
loss_name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
avg_cost
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
build_strategy
</span><span
class=
"p"
>
,
</span>
...
...
@@ -376,11 +380,11 @@
<blockquote>
<p>
注: 此示例不能直接运行,因为需要加载
<code>
${model_dir}
</code>
下的模型,所以不能直接运行。
</p>
</blockquote>
<p><div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.dataset.mnist
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
reader
</span>
<p><div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.dataset.mnist
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
reader
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
paddleslim.quant
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
quant_post
</span>
<span
class=
"n"
>
val_reader
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
reader
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
train
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
True
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
True
</span>
<span
class=
"n"
>
place
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CUDAPlace
</span><span
class=
"p"
>
(
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"k"
>
else
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CPUPlace
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
exe
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Executor
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
place
</span><span
class=
"p"
>
)
</span>
...
...
@@ -419,22 +423,22 @@
<p><strong>
返回类型
</strong></p>
<p><code>
fluid.Program
</code></p>
<p><strong>
代码示例
</strong>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddleslim.quant
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
quant
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddleslim.quant
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
quant
</span>
<span
class=
"n"
>
train_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Program
</span><span
class=
"p"
>
()
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_program
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
input_word
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
input_word
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
input_word
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
input_word
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
input_emb
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
embedding
</span><span
class=
"p"
>
(
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
input_word
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
is_sparse
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
is_sparse
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
False
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
100
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
128
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
param_attr
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
ParamAttr
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
emb
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
initializer
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
initializer
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Uniform
</span><span
class=
"p"
>
(
</span><span
class=
"o"
>
-
</span><span
class=
"mf"
>
0.005
</span><span
class=
"p"
>
,
</span>
<span
class=
"mf"
>
0.005
</span><span
class=
"p"
>
)))
</span>
<span
class=
"n"
>
infer_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
clone
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
infer_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
clone
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
True
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
True
</span>
<span
class=
"n"
>
place
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CUDAPlace
</span><span
class=
"p"
>
(
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
use_gpu
</span>
<span
class=
"k"
>
else
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CPUPlace
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
exe
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Executor
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
place
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
exe
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
run
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
default_startup_program
</span><span
class=
"p"
>
())
</span>
...
...
api/single_distiller_api/index.html
浏览文件 @
ce4dc254
此差异已折叠。
点击以展开。
index.html
浏览文件 @
ce4dc254
...
...
@@ -83,6 +83,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -290,5 +294,5 @@ python setup.py install
<!--
MkDocs version : 1.0.4
Build Date UTC : 2020-0
1-22 09:09:4
9
Build Date UTC : 2020-0
2-03 06:29:1
9
-->
model_zoo/index.html
浏览文件 @
ce4dc254
...
...
@@ -105,6 +105,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -953,7 +957,7 @@
<div
class=
"rst-footer-buttons"
role=
"navigation"
aria-label=
"footer navigation"
>
<a
href=
"../tutorials/
quant_post_demo/"
class=
"btn btn-neutral float-right"
title=
"离线量化
"
>
Next
<span
class=
"icon icon-circle-arrow-right"
></span></a>
<a
href=
"../tutorials/
pruning_tutorial/"
class=
"btn btn-neutral float-right"
title=
"图像分类模型通道剪裁-快速开始
"
>
Next
<span
class=
"icon icon-circle-arrow-right"
></span></a>
<a
href=
".."
class=
"btn btn-neutral"
title=
"Home"
><span
class=
"icon icon-circle-arrow-left"
></span>
Previous
</a>
...
...
@@ -987,7 +991,7 @@
<span><a
href=
".."
style=
"color: #fcfcfc;"
>
«
Previous
</a></span>
<span
style=
"margin-left: 15px"
><a
href=
"../tutorials/
quant_post_demo
/"
style=
"color: #fcfcfc"
>
Next
»
</a></span>
<span
style=
"margin-left: 15px"
><a
href=
"../tutorials/
pruning_tutorial
/"
style=
"color: #fcfcfc"
>
Next
»
</a></span>
</span>
</div>
...
...
search.html
浏览文件 @
ce4dc254
...
...
@@ -58,6 +58,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"./tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"./tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
search/search_index.json
浏览文件 @
ce4dc254
此差异已折叠。
点击以展开。
search_space/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -247,10 +251,10 @@
<div
class=
"codehilite"
><pre><span></span><span
class=
"c1"
>
### 引入搜索空间基类函数和search space的注册类函数
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
.search_space_base
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
SearchSpaceBase
</span>
<span
class=
"kn"
>
from
</span>
<span
class=
"nn"
>
.search_space_registry
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"n"
>
SEARCHSPACE
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
numpy
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
np
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
numpy
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
np
</span>
<span
class=
"c1"
>
### 需要调用注册函数把自定义搜索空间注册到space space中
</span>
<span
class=
"nd"
>
@SEARCHSPACE
.
register
</span>
<span
class=
"nd"
>
@SEARCHSPACE
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
register
</span>
<span
class=
"c1"
>
### 定义一个继承SearchSpaceBase基类的搜索空间的类函数
</span>
<span
class=
"k"
>
class
</span>
<span
class=
"nc"
>
ResNetBlockSpace2
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
SearchSpaceBase
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"fm"
>
__init__
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
input_size
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
output_size
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
block_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
block_mask
</span><span
class=
"p"
>
):
</span>
...
...
@@ -267,8 +271,8 @@
<span
class=
"k"
>
return
</span>
<span
class=
"p"
>
[
</span><span
class=
"nb"
>
len
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
filter_num
</span><span
class=
"p"
>
)]
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"mi"
>
3
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"nb"
>
len
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
block_mask
</span><span
class=
"p"
>
)
</span>
<span
class=
"c1"
>
### 把token转换成模型结构
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
token2arch
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
tokens
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
tokens
</span>
<span
class=
"o"
>
==
</span>
<span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
:
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
token2arch
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
tokens
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
tokens
</span>
<span
class=
"o"
>
==
</span>
<span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
:
</span>
<span
class=
"n"
>
tokens
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
init_tokens
</span><span
class=
"p"
>
()
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
bottleneck_params_list
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[]
</span>
...
...
@@ -281,28 +285,28 @@
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
net_arch
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
for
</span>
<span
class=
"n"
>
i
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
layer_setting
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"nb"
>
enumerate
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
bottleneck_params_list
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
layer_setting
</span><span
class=
"p"
>
[:
</span><span
class=
"o"
>
-
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
layer_setting
</span><span
class=
"p"
>
[
</span><span
class=
"o"
>
-
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
]
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
_resnet_block
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
resnet_layer
{}
'
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
i
</span><span
class=
"o"
>
+
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
))
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
_resnet_block
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
resnet_layer
</span><span
class=
"si"
>
{}
</span><span
class=
"s1"
>
'
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
i
</span><span
class=
"o"
>
+
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
))
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"n"
>
net_arch
</span>
<span
class=
"c1"
>
### 构造具体block的操作
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
_resnet_block
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
_resnet_block
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
shortcut_conv
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
_shortcut
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
2
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
_conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
relu
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s1"
>
'
_conv0
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
_conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
relu
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s1"
>
'
_conv1
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
_conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
2
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"s1"
>
'
_conv2
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
elementwise_add
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
x
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
shortcut_conv
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
y
</span><span
class=
"o"
>
=
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
axis
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
+
</span><span
class=
"s1"
>
'
_elementwise_add
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
_shortcut
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
_shortcut
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
channel_in
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
shape
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
]
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
channel_in
</span>
<span
class=
"o"
>
!=
</span>
<span
class=
"n"
>
channel_num
</span>
<span
class=
"ow"
>
or
</span>
<span
class=
"n"
>
stride
</span>
<span
class=
"o"
>
!=
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
:
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"bp"
>
self
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
channel_num
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
+
</span><span
class=
"s1"
>
'
_shortcut
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
else
</span><span
class=
"p"
>
:
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"nb"
>
input
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
_conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
padding
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
SAME
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
bp"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"bp
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
_conv_bn_layer
</span><span
class=
"p"
>
(
</span><span
class=
"bp"
>
self
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
padding
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
SAME
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"
kc"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"kc
"
>
None
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
conv
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
conv2d
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
num_filters
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
filter_size
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
stride
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
+
</span><span
class=
"s1"
>
'
_conv
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
bn
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
batch_norm
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
conv
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
act
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
+
</span><span
class=
"s1"
>
'
_bn
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"n"
>
bn
</span>
...
...
sitemap.xml
浏览文件 @
ce4dc254
...
...
@@ -2,77 +2,82 @@
<urlset
xmlns=
"http://www.sitemaps.org/schemas/sitemap/0.9"
>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-0
1-22
</lastmod>
<lastmod>
2020-0
2-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-01-22
</lastmod>
<lastmod>
2020-02-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
<url>
<loc>
None
</loc>
<lastmod>
2020-02-03
</lastmod>
<changefreq>
daily
</changefreq>
</url>
</urlset>
\ No newline at end of file
sitemap.xml.gz
浏览文件 @
ce4dc254
无法预览此类型文件
table_latency/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../tutorials/pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../tutorials/quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
tutorials/demo_guide/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
tutorials/distillation_demo/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -199,8 +203,8 @@
<span
class=
"n"
>
student_startup
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Program
</span><span
class=
"p"
>
()
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
student_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
student_startup
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
image
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
image
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
]
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"p"
>
[
</span><span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
label
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
label
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
image
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
]
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"p"
>
[
</span><span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
label
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
label
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"c1"
>
# student model definition
</span>
<span
class=
"n"
>
model
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
MobileNet
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
out
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
model
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
net
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
image
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
class_dim
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1000
</span><span
class=
"p"
>
)
</span>
...
...
@@ -216,7 +220,7 @@
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
teacher_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
teacher_startup
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
unique_name
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
guard
</span><span
class=
"p"
>
():
</span>
<span
class=
"n"
>
image
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
data
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
]
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"p"
>
[
</span><span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
data
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
]
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"p"
>
[
</span><span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
224
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"c1"
>
# teacher model definition
</span>
<span
class=
"n"
>
teacher_model
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
ResNet
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
predict
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
teacher_model
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
net
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
image
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
class_dim
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1000
</span><span
class=
"p"
>
)
</span>
...
...
@@ -240,8 +244,8 @@
<span
class=
"n"
>
student_vars
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
append
</span><span
class=
"p"
>
((
</span><span
class=
"n"
>
v
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
v
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
shape
</span><span
class=
"p"
>
))
</span>
<span
class=
"k"
>
except
</span><span
class=
"p"
>
:
</span>
<span
class=
"k"
>
pass
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
student_model_vars
"
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"p"
>
)
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
student_vars
</span><span
class=
"p"
>
)
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
student_model_vars
"
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"p"
>
)
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
student_vars
</span><span
class=
"p"
>
)
</span>
<span
class=
"c1"
>
# get all teacher variables
</span>
<span
class=
"n"
>
teacher_vars
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[]
</span>
<span
class=
"k"
>
for
</span>
<span
class=
"n"
>
v
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"n"
>
teacher_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
list_vars
</span><span
class=
"p"
>
():
</span>
...
...
@@ -249,8 +253,8 @@
<span
class=
"n"
>
teacher_vars
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
append
</span><span
class=
"p"
>
((
</span><span
class=
"n"
>
v
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
v
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
shape
</span><span
class=
"p"
>
))
</span>
<span
class=
"k"
>
except
</span><span
class=
"p"
>
:
</span>
<span
class=
"k"
>
pass
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
teacher_model_vars
"
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"p"
>
)
</span>
<span
class=
"
k
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
teacher_vars
</span><span
class=
"p"
>
)
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
teacher_model_vars
"
</span><span
class=
"o"
>
+
</span><span
class=
"s2"
>
"
=
"
</span><span
class=
"o"
>
*
</span><span
class=
"mi"
>
50
</span><span
class=
"p"
>
)
</span>
<span
class=
"
nb
"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
teacher_vars
</span><span
class=
"p"
>
)
</span>
</pre></div>
<h3
id=
"4-programmerge"
>
4. 合并Program(merge)
<a
class=
"headerlink"
href=
"#4-programmerge"
title=
"Permanent link"
>
#
</a></h3>
...
...
tutorials/nas_demo/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
@@ -195,7 +199,7 @@
<span
class=
"n"
>
init_temperature
</span><span
class=
"o"
>
=
</span><span
class=
"mf"
>
10.24
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
reduce_rate
</span><span
class=
"o"
>
=
</span><span
class=
"mf"
>
0.85
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
search_steps
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
300
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
is_server
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
is_server
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
True
</span><span
class=
"p"
>
)
</span>
</pre></div>
<h3
id=
"3-nas"
>
3. 根据实例化的NAS得到当前的网络结构
<a
class=
"headerlink"
href=
"#3-nas"
title=
"Permanent link"
>
#
</a></h3>
...
...
@@ -203,24 +207,24 @@
</pre></div>
<h3
id=
"4-program"
>
4. 根据得到的网络结构和输入构造训练和测试program
<a
class=
"headerlink"
href=
"#4-program"
title=
"Permanent link"
>
#
</a></h3>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k
n
"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"k"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"n"
>
train_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Program
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
test_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Program
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
startup_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
Program
</span><span
class=
"p"
>
()
</span>
<span
class=
"k"
>
with
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
program_guard
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
startup_program
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
data
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
data
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
label
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
label
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
data
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
data
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
3
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
32
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
float32
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
label
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
label
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
shape
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
1
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
dtype
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
int64
'
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
for
</span>
<span
class=
"n"
>
arch
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"n"
>
archs
</span><span
class=
"p"
>
:
</span>
<span
class=
"n"
>
data
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
arch
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
output
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
fc
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
data
</span><span
class=
"p"
>
,
</span>
<span
class=
"mi"
>
10
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
softmax_out
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
softmax
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
output
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
use_cudnn
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
False
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
softmax_out
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
softmax
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
output
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
use_cudnn
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
False
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
cost
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
cross_entropy
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
softmax_out
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
label
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
label
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
avg_cost
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
mean
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
cost
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
acc_top1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
layers
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
accuracy
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
softmax_out
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
label
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
label
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
k
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
1
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
test_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
clone
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
test_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
train_program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
clone
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
sgd
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
optimizer
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
SGD
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
learning_rate
</span><span
class=
"o"
>
=
</span><span
class=
"mf"
>
1e-3
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
sgd
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
minimize
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
avg_cost
</span><span
class=
"p"
>
)
</span>
</pre></div>
...
...
tutorials/pruning_
demo
/index.html
→
tutorials/pruning_
tutorial
/index.html
浏览文件 @
ce4dc254
...
...
@@ -8,7 +8,7 @@
<link
rel=
"shortcut icon"
href=
"../../img/favicon.ico"
>
<title>
卷积通道剪裁示例
- PaddleSlim Docs
</title>
<title>
图像分类模型通道剪裁-快速开始
- PaddleSlim Docs
</title>
<link
href=
'https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700'
rel=
'stylesheet'
type=
'text/css'
>
<link
rel=
"stylesheet"
href=
"../../css/theme.css"
type=
"text/css"
/>
...
...
@@ -18,8 +18,8 @@
<script>
// Current page data
var
mkdocs_page_name
=
"
\
u5
377
\
u79ef
\
u901a
\
u9053
\
u526a
\
u88c1
\
u793a
\
u4f8
b
"
;
var
mkdocs_page_input_path
=
"
tutorials/pruning_
demo
.md
"
;
var
mkdocs_page_name
=
"
\
u5
6fe
\
u50cf
\
u5206
\
u7c7b
\
u6a21
\
u578b
\
u901a
\
u9053
\
u526a
\
u88c1-
\
u5feb
\
u901f
\
u5f00
\
u59c
b
"
;
var
mkdocs_page_input_path
=
"
tutorials/pruning_
tutorial
.md
"
;
var
mkdocs_page_url
=
null
;
</script>
...
...
@@ -63,6 +63,28 @@
<span
class=
"caption-text"
>
教程
</span>
<ul
class=
"subnav"
>
<li
class=
" current"
>
<a
class=
"current"
href=
"./"
>
图像分类模型通道剪裁-快速开始
</a>
<ul
class=
"subnav"
>
<li
class=
"toctree-l3"
><a
href=
"#-"
>
图像分类模型通道剪裁-快速开始
</a></li>
<ul>
<li><a
class=
"toctree-l4"
href=
"#1"
>
1. 导入依赖
</a></li>
<li><a
class=
"toctree-l4"
href=
"#2"
>
2. 构建网络
</a></li>
<li><a
class=
"toctree-l4"
href=
"#3"
>
3. 剪裁卷积层通道
</a></li>
<li><a
class=
"toctree-l4"
href=
"#4"
>
4. 训练剪裁后的模型
</a></li>
</ul>
</ul>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
...
...
@@ -147,11 +169,15 @@
<li><a
href=
"../.."
>
Docs
</a>
»
</li>
<li>
教程
»
</li>
<li>
卷积通道剪裁示例
</li>
<li>
图像分类模型通道剪裁-快速开始
</li>
<li
class=
"wy-breadcrumbs-aside"
>
<a
href=
"https://github.com/PaddlePaddle/PaddleSlim/edit/master/docs/tutorials/pruning_
demo
.md"
<a
href=
"https://github.com/PaddlePaddle/PaddleSlim/edit/master/docs/tutorials/pruning_
tutorial
.md"
class=
"icon icon-github"
>
Edit on GitHub
</a>
</li>
...
...
@@ -161,40 +187,87 @@
<div
role=
"main"
>
<div
class=
"section"
>
<h1
id=
"
_1"
>
卷积通道剪裁示例
<a
class=
"headerlink"
href=
"#_1
"
title=
"Permanent link"
>
#
</a></h1>
<p>
本示例将演示如何按指定的剪裁率对每个卷积层的通道数进行剪裁。该示例默认会自动下载并使用mnist数据。
</p>
<p>
当前示例支持以下分类模型
:
</p>
<
u
l>
<li>
MobileNetV1
</li>
<li>
MobileNetV2
</li>
<li>
ResNet50
</li>
<li>
PVANet
</li>
</
u
l>
<
h2
id=
"_2"
>
接口介绍
<a
class=
"headerlink"
href=
"#_2"
title=
"Permanent link"
>
#
</a></h2
>
<
p>
该示例使用了
<code>
paddleslim.Pruner
</code>
工具类,用户接口使用介绍请参考:
<a
href=
"https://paddlepaddle.github.io/PaddleSlim/api/prune_api/"
>
API文档
</a></p
>
<
h2
id=
"_3"
>
确定待裁参数
<a
class=
"headerlink"
href=
"#_3"
title=
"Permanent link"
>
#
</a></h2
>
<
p>
不同模型的参数命名不同,在剪裁前需要确定待裁卷积层的参数名称。可通过以下方法列出所有参数名:
</p
>
<
div
class=
"codehilite"
><pre><span></span><span
class=
"k"
>
for
</span>
<span
class=
"n"
>
param
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"n"
>
program
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
global_block
</span><span
class=
"p"
>
()
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
all_parameters
</span><span
class=
"p"
>
():
</span>
<span
class=
"k"
>
print
</span><span
class=
"p"
>
(
</span><span
class=
"s2"
>
"
param name: {}; shape: {}
"
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
format
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
param
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
param
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
shape
</span><span
class=
"p"
>
))
</span>
<h1
id=
"
-"
>
图像分类模型通道剪裁-快速开始
<a
class=
"headerlink"
href=
"#-
"
title=
"Permanent link"
>
#
</a></h1>
<p>
该教程以图像分类模型MobileNetV1为例,说明如何快速使用
<a
href=
""
>
PaddleSlim的卷积通道剪裁接口
</a>
。
该示例包含以下步骤
:
</p>
<
o
l>
<li>
导入依赖
</li>
<li>
构建模型
</li>
<li>
剪裁
</li>
<li>
训练剪裁后的模型
</li>
</
o
l>
<
p>
以下章节依次次介绍每个步骤的内容。
</p
>
<
h2
id=
"1"
>
1. 导入依赖
<a
class=
"headerlink"
href=
"#1"
title=
"Permanent link"
>
#
</a></h2
>
<
p>
PaddleSlim依赖Paddle1.7版本,请确认已正确安装Paddle,然后按以下方式导入Paddle和PaddleSlim:
</p
>
<
div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle
</span
>
<
span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.fluid
</span>
<span
class=
"kn"
>
as
</span>
<span
class=
"nn"
>
fluid
</span>
<span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddleslim
</span>
<span
class=
"kn"
>
as
</span>
<span
class=
"nn"
>
slim
</span>
</pre></div>
<
p>
在
<code>
train.py
</code>
脚本中,提供了
<code>
get_pruned_params
</code>
方法,根据用户设置的选项
<code>
--model
</code>
确定要裁剪的参数。
</p
>
<
h2
id=
"_4"
>
启动裁剪任务
<a
class=
"headerlink"
href=
"#_4"
title=
"Permanent link"
>
#
</a></h2>
<p>
通过以下命令启动裁剪任务
:
</p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"
n"
>
export
</span>
<span
class=
"n"
>
CUDA_VISIBLE_DEVICES
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
0
</span>
<span
class=
"
n"
>
python
</span>
<span
class=
"n"
>
train
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
py
</span>
<
h2
id=
"2"
>
2. 构建网络
<a
class=
"headerlink"
href=
"#2"
title=
"Permanent link"
>
#
</a></h2
>
<
p>
该章节构造一个用于对MNIST数据进行分类的分类模型,选用
<code>
MobileNetV1
</code>
,并将输入大小设置为
<code>
[1, 28, 28]
</code>
,输出类别数为10。
为了方便展示示例,我们在
<code>
paddleslim.models
</code>
下预定义了用于构建分类模型的方法,执行以下代码构建分类模型
:
</p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"
err"
>
exe, train_program, val_program, inputs, outputs =
</span>
<span
class=
"
err"
>
slim.models.image_classification(
"
MobileNet
"
, [1, 28, 28], 10, use_gpu=False)
</span>
</pre></div>
<p>
执行
<code>
python train.py --help
</code>
查看更多选项。
</p>
<h2
id=
"_5"
>
注意
<a
class=
"headerlink"
href=
"#_5"
title=
"Permanent link"
>
#
</a></h2>
<ol>
<li>
在接口
<code>
paddle.Pruner.prune
</code>
的参数中,
<code>
params
</code>
和
<code>
ratios
</code>
的长度需要一样。
</li>
</ol>
<blockquote>
<p>
注意:paddleslim.models下的API并非PaddleSlim常规API,是为了简化示例而封装预定义的一系列方法,比如:模型结构的定义、Program的构建等。
</p>
</blockquote>
<h2
id=
"3"
>
3. 剪裁卷积层通道
<a
class=
"headerlink"
href=
"#3"
title=
"Permanent link"
>
#
</a></h2>
<h3
id=
"31-flops"
>
3.1 计算剪裁之前的FLOPs
<a
class=
"headerlink"
href=
"#31-flops"
title=
"Permanent link"
>
#
</a></h3>
<div
class=
"codehilite"
><pre><span></span><span
class=
"err"
>
FLOPs = slim.analysis.flops(train_program)
</span>
<span
class=
"err"
>
print(
"
FLOPs: {}
"
.format(FLOPs))
</span>
</pre></div>
<h3
id=
"32"
>
3.2 剪裁
<a
class=
"headerlink"
href=
"#32"
title=
"Permanent link"
>
#
</a></h3>
<p>
我们这里对参数名为
<code>
conv2_1_sep_weights
</code>
和
<code>
conv2_2_sep_weights
</code>
的卷积层进行剪裁,分别剪掉20%和30%的通道数。
代码如下所示:
</p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"err"
>
pruner = slim.prune.Pruner()
</span>
<span
class=
"err"
>
pruned_program, _, _ = pruner.prune(
</span>
<span
class=
"err"
>
train_program,
</span>
<span
class=
"err"
>
fluid.global_scope(),
</span>
<span
class=
"err"
>
params=[
"
conv2_1_sep_weights
"
,
"
conv2_2_sep_weights
"
],
</span>
<span
class=
"err"
>
ratios=[0.33] * 2,
</span>
<span
class=
"err"
>
place=fluid.CPUPlace())
</span>
</pre></div>
<p>
以上操作会修改
<code>
train_program
</code>
中对应卷积层参数的定义,同时对
<code>
fluid.global_scope()
</code>
中存储的参数数组进行裁剪。
</p>
<h3
id=
"33-flops"
>
3.3 计算剪裁之后的FLOPs
<a
class=
"headerlink"
href=
"#33-flops"
title=
"Permanent link"
>
#
</a></h3>
<div
class=
"codehilite"
><pre><span></span><span
class=
"err"
>
FLOPs = paddleslim.analysis.flops(train_program)
</span>
<span
class=
"err"
>
print(
"
FLOPs: {}
"
.format(FLOPs))
</span>
</pre></div>
<h2
id=
"4"
>
4. 训练剪裁后的模型
<a
class=
"headerlink"
href=
"#4"
title=
"Permanent link"
>
#
</a></h2>
<h3
id=
"41"
>
4.1 定义输入数据
<a
class=
"headerlink"
href=
"#41"
title=
"Permanent link"
>
#
</a></h3>
<p>
为了快速执行该示例,我们选取简单的MNIST数据,Paddle框架的
<code>
paddle.dataset.mnist
</code>
包定义了MNIST数据的下载和读取。
代码如下:
</p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"kn"
>
import
</span>
<span
class=
"nn"
>
paddle.dataset.mnist
</span>
<span
class=
"kn"
>
as
</span>
<span
class=
"nn"
>
reader
</span>
<span
class=
"n"
>
train_reader
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
paddle
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
batch
</span><span
class=
"p"
>
(
</span>
<span
class=
"n"
>
reader
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
train
</span><span
class=
"p"
>
(),
</span>
<span
class=
"n"
>
batch_size
</span><span
class=
"o"
>
=
</span><span
class=
"mi"
>
128
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
drop_last
</span><span
class=
"o"
>
=
</span><span
class=
"bp"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
train_feeder
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
DataFeeder
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
inputs
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
CPUPlace
</span><span
class=
"p"
>
())
</span>
</pre></div>
<h3
id=
"42"
>
4.2 执行训练
<a
class=
"headerlink"
href=
"#42"
title=
"Permanent link"
>
#
</a></h3>
<p>
以下代码执行了一个
<code>
epoch
</code>
的训练:
</p>
<div
class=
"codehilite"
><pre><span></span><span
class=
"err"
>
for data in train_reader():
</span>
<span
class=
"err"
>
acc1, acc5, loss = exe.run(pruned_program, feed=train_feeder.feed(data), fetch_list=outputs)
</span>
<span
class=
"err"
>
print(acc1, acc5, loss)
</span>
</pre></div>
</div>
</div>
<footer>
<div
class=
"rst-footer-buttons"
role=
"navigation"
aria-label=
"footer navigation"
>
<a
href=
"../quant_post_demo/"
class=
"btn btn-neutral float-right"
title=
"离线量化"
>
Next
<span
class=
"icon icon-circle-arrow-right"
></span></a>
<a
href=
"../../model_zoo/"
class=
"btn btn-neutral"
title=
"模型库"
><span
class=
"icon icon-circle-arrow-left"
></span>
Previous
</a>
</div>
<hr/>
...
...
@@ -219,6 +292,10 @@
<a
href=
"https://github.com/PaddlePaddle/PaddleSlim/"
class=
"fa fa-github"
style=
"float: left; color: #fcfcfc"
>
GitHub
</a>
<span><a
href=
"../../model_zoo/"
style=
"color: #fcfcfc;"
>
«
Previous
</a></span>
<span
style=
"margin-left: 15px"
><a
href=
"../quant_post_demo/"
style=
"color: #fcfcfc"
>
Next
»
</a></span>
</span>
</div>
...
...
tutorials/quant_aware_demo/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
" current"
>
...
...
@@ -195,20 +199,20 @@
<span
class=
"s1"
>
'
dtype
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"s1"
>
'
int8
'
</span><span
class=
"p"
>
,
</span>
<span
class=
"s1"
>
'
window_size
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"mi"
>
10000
</span><span
class=
"p"
>
,
</span>
<span
class=
"s1"
>
'
moving_rate
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"mf"
>
0.9
</span><span
class=
"p"
>
,
</span>
<span
class=
"s1"
>
'
quant_weight_only
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"
bp
"
>
False
</span>
<span
class=
"s1"
>
'
quant_weight_only
'
</span><span
class=
"p"
>
:
</span>
<span
class=
"
kc
"
>
False
</span>
<span
class=
"p"
>
}
</span>
</pre></div>
<h3
id=
"2-programop"
>
2. 对训练和测试program插入可训练量化op
<a
class=
"headerlink"
href=
"#2-programop"
title=
"Permanent link"
>
#
</a></h3>
<div
class=
"codehilite"
><pre><span></span><span
class=
"n"
>
val_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
val_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
quant_config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
scope
</span><span
class=
"o"
>
=
</span><span
class=
"
bp"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<div
class=
"codehilite"
><pre><span></span><span
class=
"n"
>
val_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
val_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
quant_config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
scope
</span><span
class=
"o"
>
=
</span><span
class=
"
kc"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"kc
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
compiled_train_prog
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_prog
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
quant_config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
scope
</span><span
class=
"o"
>
=
</span><span
class=
"
bp"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"bp
"
>
False
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
compiled_train_prog
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
quant_aware
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
train_prog
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
quant_config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
scope
</span><span
class=
"o"
>
=
</span><span
class=
"
kc"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
for_test
</span><span
class=
"o"
>
=
</span><span
class=
"kc
"
>
False
</span><span
class=
"p"
>
)
</span>
</pre></div>
<h3
id=
"3build"
>
3.关掉指定build策略
<a
class=
"headerlink"
href=
"#3build"
title=
"Permanent link"
>
#
</a></h3>
<div
class=
"codehilite"
><pre><span></span><span
class=
"n"
>
build_strategy
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
BuildStrategy
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
fuse_all_reduce_ops
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
False
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
sync_batch_norm
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
bp
"
>
False
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
fuse_all_reduce_ops
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
False
</span>
<span
class=
"n"
>
build_strategy
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
sync_batch_norm
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"
kc
"
>
False
</span>
<span
class=
"n"
>
exec_strategy
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fluid
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
ExecutionStrategy
</span><span
class=
"p"
>
()
</span>
<span
class=
"n"
>
compiled_train_prog
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
compiled_train_prog
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
with_data_parallel
</span><span
class=
"p"
>
(
</span>
<span
class=
"n"
>
loss_name
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
avg_cost
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
...
...
@@ -220,8 +224,8 @@
<div
class=
"codehilite"
><pre><span></span><span
class=
"n"
>
float_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
int8_program
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
convert
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
val_program
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
place
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
quant_config
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
scope
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
save_int8
</span><span
class=
"o"
>
=
</span><span
class=
"
bp
"
>
True
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
scope
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
None
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
save_int8
</span><span
class=
"o"
>
=
</span><span
class=
"
kc
"
>
True
</span><span
class=
"p"
>
)
</span>
</pre></div>
<h3
id=
"5"
>
5.保存预测模型
<a
class=
"headerlink"
href=
"#5"
title=
"Permanent link"
>
#
</a></h3>
...
...
tutorials/quant_embedding_demo/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
tutorials/quant_post_demo/index.html
浏览文件 @
ce4dc254
...
...
@@ -63,6 +63,10 @@
<span
class=
"caption-text"
>
教程
</span>
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
" current"
>
<a
class=
"current"
href=
"./"
>
离线量化
</a>
...
...
@@ -239,7 +243,7 @@
<a
href=
"../quant_aware_demo/"
class=
"btn btn-neutral float-right"
title=
"量化训练"
>
Next
<span
class=
"icon icon-circle-arrow-right"
></span></a>
<a
href=
"../
../model_zoo/"
class=
"btn btn-neutral"
title=
"模型库
"
><span
class=
"icon icon-circle-arrow-left"
></span>
Previous
</a>
<a
href=
"../
pruning_tutorial/"
class=
"btn btn-neutral"
title=
"图像分类模型通道剪裁-快速开始
"
><span
class=
"icon icon-circle-arrow-left"
></span>
Previous
</a>
</div>
...
...
@@ -267,7 +271,7 @@
<a
href=
"https://github.com/PaddlePaddle/PaddleSlim/"
class=
"fa fa-github"
style=
"float: left; color: #fcfcfc"
>
GitHub
</a>
<span><a
href=
"../
../model_zoo
/"
style=
"color: #fcfcfc;"
>
«
Previous
</a></span>
<span><a
href=
"../
pruning_tutorial
/"
style=
"color: #fcfcfc;"
>
«
Previous
</a></span>
<span
style=
"margin-left: 15px"
><a
href=
"../quant_aware_demo/"
style=
"color: #fcfcfc"
>
Next
»
</a></span>
...
...
tutorials/sensitivity_demo/index.html
浏览文件 @
ce4dc254
...
...
@@ -65,6 +65,10 @@
<ul
class=
"subnav"
>
<li
class=
""
>
<a
class=
""
href=
"../pruning_tutorial/"
>
图像分类模型通道剪裁-快速开始
</a>
</li>
<li
class=
""
>
<a
class=
""
href=
"../quant_post_demo/"
>
离线量化
</a>
</li>
<li
class=
""
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录