From 7e0913ca5c11a8a9bc0fe04901b72cafe6af21c4 Mon Sep 17 00:00:00 2001 From: wanghaoshuang Date: Tue, 10 Mar 2020 12:41:51 +0800 Subject: [PATCH] Update --- _sources/algo/algo.md.txt | 27 ++- _sources/api_cn/index.rst.txt | 2 +- _sources/api_cn/nas_api.rst.txt | 4 +- _sources/api_cn/quantization_api.rst.txt | 81 +++---- _sources/api_en/index_en.rst.txt | 2 +- .../quick_start/quant_aware_tutorial.md.txt | 8 +- .../quant_aware_tutorial_en.md.txt | 6 +- .../quick_start/quant_post_tutorial.md.txt | 6 +- .../quick_start/quant_post_tutorial_en.md.txt | 2 +- algo/algo.html | 67 +++--- api_cn/nas_api.html | 7 +- api_cn/quantization_api.html | 79 +++---- api_cn/search_space.html | 216 +++++++++--------- api_en/search_space_en.html | 210 +++++++++-------- quick_start/quant_aware_tutorial.html | 6 +- quick_start/quant_aware_tutorial_en.html | 6 +- quick_start/quant_post_tutorial.html | 4 +- quick_start/quant_post_tutorial_en.html | 2 +- searchindex.js | 2 +- 19 files changed, 367 insertions(+), 370 deletions(-) diff --git a/_sources/algo/algo.md.txt b/_sources/algo/algo.md.txt index 772d7384..abfdaca7 100644 --- a/_sources/algo/algo.md.txt +++ b/_sources/algo/algo.md.txt @@ -14,14 +14,14 @@ 近年来,定点量化使用更少的比特数(如8-bit、3-bit、2-bit等)表示神经网络的权重和激活已被验证是有效的。定点量化的优点包括低内存带宽、低功耗、低计算资源占用以及低模型存储需求等。

-
+
表1: 不同类型操作的开销对比

由表1可知,低精度定点数操作的硬件面积大小及能耗比高精度浮点数要少几个数量级。 使用定点量化可带来4倍的模型压缩、4倍的内存带宽提升,以及更高效的cache利用(很多硬件设备,内存访问是主要能耗)。除此之外,计算速度也会更快(通常具有2x-3x的性能提升)。由表2可知,在很多场景下,定点量化操作对精度并不会造成损失。另外,定点量化对神经网络于嵌入式设备上的推断来说是极其重要的。

-
+
表2:模型量化前后精度对比

@@ -45,7 +45,7 @@ $q = scale * r + b$ 前向传播过程采用模拟量化的方式,具体描述如下:

-
+
图1:基于模拟量化训练的前向过程

@@ -69,7 +69,7 @@ $$ 上述公式表明反量化操作可以被移动到`GEMM`之前,即先对$Xq$和$Wq$执行反量化操作再做`GEMM`操作。因此,前向传播的工作流亦可表示为如下方式:

-
+
图2:基于模拟量化训练前向过程的等价工作流

@@ -79,7 +79,7 @@ $$ 由图3可知,权重更新所需的梯度值可以由量化后的权重和量化后的激活求得。反向传播过程中的所有输入和输出均为32-bit浮点型数据。注意,梯度更新操作需要在原始权重上进行,即计算出的梯度将被加到原始权重上而非量化后或反量化后的权重上。

-
+
图3:基于模拟量化训练的反向传播和权重更新过程

@@ -127,7 +127,7 @@ $$ Vt = (1 - k) * V + k * V_{t-1} $$

-
+
图4

@@ -139,7 +139,7 @@ $$ Vt = (1 - k) * V + k * V_{t-1} $$ 减去被删除的一行:greedy pruning

-
+
图5

@@ -149,7 +149,7 @@ $$ Vt = (1 - k) * V + k * V_{t-1} $$

-
+
图6

@@ -176,7 +176,7 @@ $$ Vt = (1 - k) * V + k * V_{t-1} $$ #### 敏感度的理解

-
+
图7

@@ -189,7 +189,7 @@ $$ Vt = (1 - k) * V + k * V_{t-1} $$ 用户给定一个模型整体的剪裁率,我们通过移动**图5**中的黑色实线来找到一组满足条件的且合法的剪裁率。

-
+
图8

@@ -206,12 +206,11 @@ $$ Vt = (1 - k) * V + k * V_{t-1} $$ 一般情况下,模型参数量越多,结构越复杂,其性能越好,但参数也越允余,运算量和资源消耗也越大;模型蒸馏是将复杂网络中的有用信息将复杂网络中的有用信息提取出来提取出来,迁移到一个更小的网络中去,在我们的工具包中,支持两种蒸馏的方法。 第一种是传统的蒸馏方法(参考论文:[Distilling the Knowledge in a Neural Network](https://arxiv.org/pdf/1503.02531.pdf)) 使用复杂的网络作为teacher模型去监督训练一个参数量和运算量更少的student模型。teacher模型可以是一个或者多个提前训练好的高性能模型。student模型的训练有两个目标:一个是原始的目标函数,为student模型输出的类别概率和label的交叉熵,记为hard-target;另一个是student模型输出的类别概率和teacher模型输出的类别概率的交叉熵,记为soft target,这两个loss加权后得到最终的训练loss,共同监督studuent模型的训练。 - 第二种是基于FSP的蒸馏方法(参考论文:[A Gift from Knowledge Distillation: -Fast Optimization, Network Minimization and Transfer Learning](http://openaccess.thecvf.com/content_cvpr_2017/papers/Yim_A_Gift_From_CVPR_2017_paper.pdf)) + 第二种是基于FSP的蒸馏方法(参考论文:[A Gift from Knowledge Distillation: Fast Optimization, Network Minimization and Transfer Learning](http://openaccess.thecvf.com/content_cvpr_2017/papers/Yim_A_Gift_From_CVPR_2017_paper.pdf)) 相比传统的蒸馏方法直接用小模型去拟合大模型的输出,该方法用小模型去拟合大模型不同层特征之间的转换关系,其用一个FSP矩阵(特征的内积)来表示不同层特征之间的关系,大模型和小模型不同层之间分别获得多个FSP矩阵,然后使用L2 loss让小模型的对应层FSP矩阵和大模型对应层的FSP矩阵尽量一致,具体如下图所示。这种方法的优势,通俗的解释是,比如将蒸馏类比成teacher(大模型)教student(小模型)解决一个问题,传统的蒸馏是直接告诉小模型问题的答案,让小模型学习,而学习FSP矩阵是让小模型学习解决问题的中间过程和方法,因此其学到的信息更多。

-
+
图9

@@ -258,7 +257,7 @@ e^{\frac{(r_k-r)}{T_k}} & r_k < r\\ 因为要搜索出在移动端运行速度快的模型,我们参考了MobileNetV2中的Linear Bottlenecks和Inverted residuals结构,搜索每一个Inverted residuals中的具体参数,包括kernelsize、channel扩张倍数、重复次数、channels number。如图10所示:

-
+
图10

diff --git a/_sources/api_cn/index.rst.txt b/_sources/api_cn/index.rst.txt index 81515877..72294948 100644 --- a/_sources/api_cn/index.rst.txt +++ b/_sources/api_cn/index.rst.txt @@ -16,5 +16,5 @@ API文档 prune_api.rst quantization_api.rst single_distiller_api.rst - search_space.rst + search_space.md table_latency.md diff --git a/_sources/api_cn/nas_api.rst.txt b/_sources/api_cn/nas_api.rst.txt index d5ddaa58..b09fe477 100644 --- a/_sources/api_cn/nas_api.rst.txt +++ b/_sources/api_cn/nas_api.rst.txt @@ -5,7 +5,7 @@ SA-NAS ---------------------- -通过参数配置搜索空间。更多搜索空间的使用可以参考: [search_space](../search_space.md) +通过参数配置搜索空间。更多搜索空间的使用可以参考: `search_space `_ **参数:** @@ -119,7 +119,7 @@ SANAS(Simulated Annealing Neural Architecture Search)是基于模拟退火 sanas.reward(float(score)) - .. py:methd:: tokens2arch(tokens) + .. py:method:: tokens2arch(tokens) 通过一组tokens得到实际的模型结构,一般用来把搜索到最优的token转换为模型结构用来做最后的训练。tokens的形式是一个列表,tokens映射到搜索空间转换成相应的网络结构,一组tokens对应唯一的一个网络结构。 diff --git a/_sources/api_cn/quantization_api.rst.txt b/_sources/api_cn/quantization_api.rst.txt index faa37918..aa853f0b 100644 --- a/_sources/api_cn/quantization_api.rst.txt +++ b/_sources/api_cn/quantization_api.rst.txt @@ -51,15 +51,15 @@ - **weight_quantize_type(str)** - 参数量化方式。可选 ``'abs_max'`` , ``'channel_wise_abs_max'`` , ``'range_abs_max'`` , ``'moving_average_abs_max'`` 。如果使用 ``TensorRT`` 加载量化后的模型来预测,请使用 ``'channel_wise_abs_max'`` 。 默认 ``'channel_wise_abs_max'`` 。 - **activation_quantize_type(str)** - 激活量化方式,可选 ``'abs_max'`` , ``'range_abs_max'`` , ``'moving_average_abs_max'`` 。如果使用 ``TensorRT`` 加载量化后的模型来预测,请使用 ``'range_abs_max', 'moving_average_abs_max'`` 。,默认 ``'moving_average_abs_max'`` 。 -- **weight_bits(int)** - 参数量化bit数,默认8, 推荐设为8。 -- **activation_bits(int)** - 激活量化bit数,默认8, 推荐设为8。 -- **not_quant_pattern(str | list[str])** - 所有 ``name_scope`` 包含 ``'not_quant_pattern'`` 字符串的 ``op`` ,都不量化, 设置方式请参考 `fluid.name_scope `_ 。 -- **quantize_op_types(list[str])** - 需要进行量化的 ``op`` 类型,目前支持 ``'conv2d', 'depthwise_conv2d', 'mul'`` 。 +- **weight_bits(int)** - 参数量化bit数,默认8, 可选1-8,推荐设为8,因为量化后的数据类型是 ``int8`` 。 +- **activation_bits(int)** - 激活量化bit数,默认8,可选1-8,推荐设为8,因为量化后的数据类型是 ``int8`` 。 +- **not_quant_pattern(str | list[str])** - 所有 ``name_scope`` 包含 ``'not_quant_pattern'`` 字符串的 op ,都不量化, 设置方式请参考 `fluid.name_scope `_ 。 +- **quantize_op_types(list[str])** - 需要进行量化的 op 类型,目前支持 ``'conv2d', 'depthwise_conv2d', 'mul'`` 。 - **dtype(int8)** - 量化后的参数类型,默认 ``int8`` , 目前仅支持 ``int8`` 。 - **window_size(int)** - ``'range_abs_max'`` 量化方式的 ``window size`` ,默认10000。 - **moving_rate(int)** - ``'moving_average_abs_max'`` 量化方式的衰减系数,默认 0.9。 - **for_tensorrt(bool)** - 量化后的模型是否使用 ``TensorRT`` 进行预测。如果是的话,量化op类型为: ``TENSORRT_OP_TYPES`` 。默认值为False. -- **is_full_quantize(bool)** - 是否量化所有可支持op类型。默认值为False. +- **is_full_quantize(bool)** - 是否量化所有可支持op类型。可量化op为 ``TRANSFORM_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES`` 。 默认值为False. .. :note:: @@ -69,22 +69,24 @@ quant_aware ------------ -.. py:function:: paddleslim.quant.quant_aware(program, place, config, scope=None, for_test=False)[[源代码]](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/paddleslim/quant/quanter.py) +.. py:function:: paddleslim.quant.quant_aware(program, place, config, scope=None, for_test=False) -在 ``program`` 中加入量化和反量化 ``op``, 用于量化训练。 +`源代码 `_ + +在 program 中加入量化和反量化op, 用于量化训练。 **参数:** -- **program (fluid.Program)** - 传入训练或测试 ``program`` 。 +- **program (fluid.Program)** - 传入训练或测试program 。 - **place(fluid.CPUPlace | fluid.CUDAPlace)** - 该参数表示 ``Executor`` 执行所在的设备。 - **config(dict)** - 量化配置表。 - **scope(fluid.Scope, optional)** - 传入用于存储 ``Variable`` 的 ``scope`` ,需要传入 ``program`` 所使用的 ``scope`` ,一般情况下,是 `fluid.global_scope() `_ 。设置为 ``None`` 时将使用 `fluid.global_scope() `_ ,默认值为 ``None`` 。 -- **for_test(bool)** - 如果 ``program`` 参数是一个测试 ``program`` , ``for_test`` 应设为 ``True`` ,否则设为 ``False`` 。 +- **for_test(bool)** - 如果 ``program`` 参数是一个测试 ``program`` , ``for_test`` 应设为True,否则设为False 。 **返回** -含有量化和反量化 ``operator`` 的 ``program`` 。 +含有量化和反量化 operator 的 program 。 **返回类型** @@ -93,10 +95,10 @@ quant_aware .. note:: - - 此接口会改变 ``program`` 结构,并且可能增加一些``persistable``的变量,所以加载模型参数时请注意和相应的``program``对应。 - - 此接口底层经历了``fluid.Program``-> ``fluid.framework.IrGraph``->``fluid.Program``的转变,在``fluid.framework.IrGraph``中没有``Parameter``的概念,``Variable``只有``persistable``和``not persistable``的区别,所以在保存和加载参数时,请使用``fluid.io.save_persistables``和``fluid.io.load_persistables``接口。 - - 由于此接口会根据``program``的结构和量化配置来对``program``添加op,所以``Paddle``中一些通过``fuse op``来加速训练的策略不能使用。已知以下策略在使用量化时必须设为``False``: ``fuse_all_reduce_ops, sync_batch_norm``。 - - 如果传入的 ``program`` 中存在和任何op都没有连接的 ``Variable`` ,则会在量化的过程中被优化掉。 + - 此接口会改变program 结构,并且可能增加一些persistable的变量,所以加载模型参数时请注意和相应的 program 对应。 + - 此接口底层经历了 fluid.Program -> fluid.framework.IrGraph -> fluid.Program 的转变,在 ``fluid.framework.IrGraph`` 中没有 ``Parameter`` 的概念,``Variable`` 只有 persistable 和not persistable的区别,所以在保存和加载参数时,请使用 ``fluid.io.save_persistables`` 和 ``fluid.io.load_persistables`` 接口。 + - 由于此接口会根据 program 的结构和量化配置来对program 添加op,所以 ``Paddle`` 中一些通过 ``fuse op`` 来加速训练的策略不能使用。已知以下策略在使用量化时必须设为False : ``fuse_all_reduce_ops, sync_batch_norm`` 。 + - 如果传入的 program 中存在和任何op都没有连接的 ``Variable`` ,则会在量化的过程中被优化掉。 @@ -108,24 +110,24 @@ convert `源代码 `_ -把训练好的量化 ``program`` ,转换为可用于保存 ``inference model`` 的 ``program`` 。 +把训练好的量化 program ,转换为可用于保存 ``inference model`` 的 program 。 **参数:** -- **program (fluid.Program)** - 传入测试``program``。 -- **place(fluid.CPUPlace | fluid.CUDAPlace)** - 该参数表示``Executor``执行所在的设备。 +- **program (fluid.Program)** - 传入测试 program 。 +- **place(fluid.CPUPlace | fluid.CUDAPlace)** - 该参数表示 ``Executor`` 执行所在的设备。 - **config(dict)** - 量化配置表。 -- **scope(fluid.Scope)** - 传入用于存储``Variable``的``scope``,需要传入``program``所使用的``scope``,一般情况下,是 `fluid.global_scope() `_ 。设置为 ``None`` 时将使用 `fluid.global_scope() `_ ,默认值为 ``None`` 。 -- **save_int8(bool)** - 是否需要返回参数为 ``int8`` 的 ``program`` 。该功能目前只能用于确认模型大小。默认值为 ``False`` 。 +- **scope(fluid.Scope)** - 传入用于存储 ``Variable`` 的 ``scope`` ,需要传入 ``program`` 所使用的 ``scope`` ,一般情况下,是 `fluid.global_scope() `_ 。设置为 ``None`` 时将使用 `fluid.global_scope() `_ ,默认值为 ``None`` 。 +- **save_int8(bool)** - 是否需要返回参数为 ``int8`` 的 program 。该功能目前只能用于确认模型大小。默认值为 ``False`` 。 **返回** -- **program (fluid.Program)** - freezed program,可用于保存inference model,参数为``float32``类型,但其数值范围可用int8表示。 -- **int8_program (fluid.Program)** - freezed program,可用于保存inference model,参数为``int8``类型。当``save_int8``为``False``时,不返回该值。 +- **program (fluid.Program)** - freezed program,可用于保存inference model,参数为 ``float32`` 类型,但其数值范围可用int8表示。 +- **int8_program (fluid.Program)** - freezed program,可用于保存inference model,参数为 ``int8`` 类型。当 ``save_int8`` 为False 时,不返回该值。 .. note:: - 因为该接口会对``op``和``Variable``做相应的删除和修改,所以此接口只能在训练完成之后调用。如果想转化训练的中间模型,可加载相应的参数之后再使用此接口。 + 因为该接口会对 op 和 Variable 做相应的删除和修改,所以此接口只能在训练完成之后调用。如果想转化训练的中间模型,可加载相应的参数之后再使用此接口。 **代码示例** @@ -186,18 +188,19 @@ quant_post - **model_dir(str)** - 需要量化的模型所在的文件夹。 - **quantize_model_path(str)** - 保存量化后的模型的路径 - **sample_generator(python generator)** - 读取数据样本,每次返回一个样本。 -- **model_filename(str, optional)** - 模型文件名,如果需要量化的模型的参数存在一个文件中,则需要设置``model_filename``为模型文件的名称,否则设置为``None``即可。默认值是``None``。 -- **params_filename(str)** - 参数文件名,如果需要量化的模型的参数存在一个文件中,则需要设置``params_filename``为参数文件的名称,否则设置为``None``即可。默认值是``None``。 +- **model_filename(str, optional)** - 模型文件名,如果需要量化的模型的参数存在一个文件中,则需要设置 ``model_filename`` 为模型文件的名称,否则设置为 ``None`` 即可。默认值是 ``None`` 。 +- **params_filename(str)** - 参数文件名,如果需要量化的模型的参数存在一个文件中,则需要设置 ``params_filename`` 为参数文件的名称,否则设置为 ``None`` 即可。默认值是 ``None`` 。 - **batch_size(int)** - 每个batch的图片数量。默认值为16 。 -- **batch_nums(int, optional)** - 迭代次数。如果设置为``None``,则会一直运行到``sample_generator`` 迭代结束, 否则,迭代次数为``batch_nums``, 也就是说参与对 ``Scale`` 进行校正的样本个数为 ``'batch_nums' * 'batch_size'`` . -- **scope(fluid.Scope, optional)** - 用来获取和写入 ``Variable`` , 如果设置为 ``None`` ,则使用 `fluid.global_scope() `_ . 默认值是``None``. +- **batch_nums(int, optional)** - 迭代次数。如果设置为 ``None`` ,则会一直运行到 ``sample_generator`` 迭代结束, 否则,迭代次数为 ``batch_nums``, 也就是说参与对 ``Scale`` 进行校正的样本个数为 ``'batch_nums' * 'batch_size'`` . +- **scope(fluid.Scope, optional)** - 用来获取和写入 ``Variable`` , 如果设置为 ``None`` ,则使用 `fluid.global_scope() `_ . 默认值是 ``None`` . - **algo(str)** - 量化时使用的算法名称,可为 ``'KL'`` 或者 ``'direct'`` 。该参数仅针对激活值的量化,因为参数值的量化使用的方式为 ``'channel_wise_abs_max'`` . 当 ``algo`` 设置为 ``'direct'`` 时,使用校正数据的激活值的绝对值的最大值当作 ``Scale`` 值,当设置为 ``'KL'`` 时,则使用KL散度的方法来计算 ``Scale`` 值。默认值为 ``'KL'`` 。 -- **quantizable_op_type(list[str])** - 需要量化的 ``op`` 类型列表。默认值为 ``["conv2d", "depthwise_conv2d", "mul"]`` 。 -- **is_full_quantize(bool)** - 是否量化所有可支持的op类型。如果设置为False, 则按照 ``'quantizable_op_type'`` 的设置进行量化。 -- **weight_bits(int)** - weight的量化比特位数。 -- **activation_bits(int)** - 激活值的量化比特位数。 -- **is_use_cache_file(bool)** - 是否使用硬盘对中间结果进行存储。如果为False, 则将中间结果存储在内存中。 -- **cache_dir(str)** - 如果 ``'is_use_cache_file'`` 为True, 则将中间结果存储在此参数设置的路径下。 +- **quantizable_op_type(list[str])** - 需要量化的 op 类型列表。默认值为 ``["conv2d", "depthwise_conv2d", "mul"]`` 。 +- **is_full_quantize(bool)** - 是否量化所有可支持的op类型。如果设置为False, 则按照 ``'quantizable_op_type'`` 的设置进行量化。如果设置为True, 则按照 `量化配置 <#id2>`_ 中 ``QUANT_DEQUANT_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES`` 定义的op进行量化。 +- **weight_bits(int)** - weight的量化比特位数, 默认值为8。 +- **activation_bits(int)** - 激活值的量化比特位数, 默认值为8。 +- **is_use_cache_file(bool)** - 是否使用硬盘对中间结果进行存储。如果为False, 则将中间结果存储在内存中。默认值为False。 +- **cache_dir(str)** - 如果 ``'is_use_cache_file'`` 为True, 则将中间结果存储在此参数设置的路径下。默认值为 ``./temp_post_training`` 。 + **返回** @@ -205,14 +208,14 @@ quant_post .. note:: - - 因为该接口会收集校正数据的所有的激活值,当校正图片比较多时,请设置``'is_use_cache_file'``为True, 将中间结果存储在硬盘中。另外,``'KL'``散度的计算比较耗时。 - - 目前``Paddle-Lite``有int8 kernel来加速的op只有 ``['conv2d', 'depthwise_conv2d', 'mul']``, 其他op的int8 kernel将陆续支持。 + - 因为该接口会收集校正数据的所有的激活值,当校正图片比较多时,请设置 ``'is_use_cache_file'`` 为True, 将中间结果存储在硬盘中。另外,``'KL'`` 散度的计算比较耗时。 + - 目前 ``Paddle-Lite`` 有int8 kernel来加速的op只有 ``['conv2d', 'depthwise_conv2d', 'mul']`` , 其他op的int8 kernel将陆续支持。 **代码示例** .. warning:: - 此示例不能直接运行,因为需要加载``${model_dir}``下的模型,所以不能直接运行。 + 此示例不能直接运行,因为需要加载 ``${model_dir}`` 下的模型,所以不能直接运行。 .. code-block:: python @@ -249,12 +252,12 @@ quant_embedding **参数:** - **program(fluid.Program)** - 需要量化的program -- **scope(fluid.Scope, optional)** - 用来获取和写入``Variable``, 如果设置为``None``,则使用 `fluid.global_scope() `_ . +- **scope(fluid.Scope, optional)** - 用来获取和写入 ``Variable``, 如果设置为 ``None``,则使用 `fluid.global_scope() `_ . - **place(fluid.CPUPlace | fluid.CUDAPlace)** - 运行program的设备 - **config(dict)** - 定义量化的配置。可以配置的参数有: - ``'params_name'`` (str, required): 需要进行量化的参数名称,此参数必须设置。 - - ``'quantize_type'`` (str, optional): 量化的类型,目前支持的类型是 ``'abs_max'``, 待支持的类型有 ``'log', 'product_quantization'`` 。 默认值是``'abs_max'`` . - - ``'quantize_bits'`` (int, optional): 量化的 ``bit`` 数,目前支持的 ``bit`` 数为8。默认值是8. + - ``'quantize_type'`` (str, optional): 量化的类型,目前支持的类型是 ``'abs_max'``, 待支持的类型有 ``'log', 'product_quantization'`` 。 默认值是 ``'abs_max'`` . + - ``'quantize_bits'`` (int, optional): 量化的bit数,目前支持的bit数为8。默认值是8. - ``'dtype'`` (str, optional): 量化之后的数据类型, 目前支持的是 ``'int8'``. 默认值是 ``int8`` 。 - ``'threshold'`` (float, optional): 量化之前将根据此阈值对需要量化的参数值进行 ``clip``. 如果不设置,则跳过 ``clip`` 过程直接量化。 @@ -293,4 +296,4 @@ fluid.Program config = {'params_name': 'emb', 'quantize_type': 'abs_max'} quant_program = quant.quant_embedding(infer_program, place, config) -更详细的用法请参考 `Embedding量化demo `_ +更详细的用法请参考 `Embedding量化demo `_ diff --git a/_sources/api_en/index_en.rst.txt b/_sources/api_en/index_en.rst.txt index 2f21132c..bd5f6552 100644 --- a/_sources/api_en/index_en.rst.txt +++ b/_sources/api_en/index_en.rst.txt @@ -16,5 +16,5 @@ API Documents paddleslim.nas.rst paddleslim.nas.one_shot.rst paddleslim.pantheon.rst - search_space_en.rst + search_space_en.md table_latency_en.md diff --git a/_sources/quick_start/quant_aware_tutorial.md.txt b/_sources/quick_start/quant_aware_tutorial.md.txt index 802f0b73..5dfc3837 100644 --- a/_sources/quick_start/quant_aware_tutorial.md.txt +++ b/_sources/quick_start/quant_aware_tutorial.md.txt @@ -1,6 +1,6 @@ # 图像分类模型量化训练-快速开始 -该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的[量化训练接口](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/docs/docs/api/quantization_api.md)。 该示例包含以下步骤: +该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的[量化训练接口](https://paddlepaddle.github.io/PaddleSlim/api_cn/quantization_api.html)。 该示例包含以下步骤: 1. 导入依赖 2. 构建模型 @@ -61,7 +61,7 @@ def train(prog): if iter % 100 == 0: print('train iter={}, top1={}, top5={}, loss={}'.format(iter, acc1.mean(), acc5.mean(), loss.mean())) iter += 1 - + def test(prog): iter = 0 res = [[], []] @@ -93,7 +93,7 @@ test(val_program) ## 4. 量化 -按照[默认配置](https://paddlepaddle.github.io/PaddleSlim/api/quantization_api/#_1)在``train_program``和``val_program``中加入量化和反量化op. +按照[默认配置](https://paddlepaddle.github.io/PaddleSlim/api_cn/quantization_api.html#id2)在``train_program``和``val_program``中加入量化和反量化op. ```python @@ -121,7 +121,7 @@ test(val_quant_program) ## 6. 保存量化后的模型 -在``4. 量化``中使用接口``slim.quant.quant_aware``接口得到的模型只适合训练时使用,为了得到最终使用时的模型,需要使用[slim.quant.convert](https://paddlepaddle.github.io/PaddleSlim/api/quantization_api/#convert)接口,然后使用[fluid.io.save_inference_model](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api_cn/io_cn/save_inference_model_cn.html#save-inference-model)保存模型。``float_prog``的参数数据类型是float32,但是数据范围是int8, 保存之后可使用fluid或者paddle-lite加载使用,paddle-lite在使用时,会先将类型转换为int8。``int8_prog``的参数数据类型是int8, 保存后可看到量化后模型大小,不可加载使用。 +在``4. 量化``中使用接口``slim.quant.quant_aware``接口得到的模型只适合训练时使用,为了得到最终使用时的模型,需要使用[slim.quant.convert](https://paddlepaddle.github.io/PaddleSlim/api_cn/quantization_api.html#convert)接口,然后使用[fluid.io.save_inference_model](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api_cn/io_cn/save_inference_model_cn.html#save-inference-model)保存模型。``float_prog``的参数数据类型是float32,但是数据范围是int8, 保存之后可使用fluid或者paddle-lite加载使用,paddle-lite在使用时,会先将类型转换为int8。``int8_prog``的参数数据类型是int8, 保存后可看到量化后模型大小,不可加载使用。 ```python diff --git a/_sources/quick_start/quant_aware_tutorial_en.md.txt b/_sources/quick_start/quant_aware_tutorial_en.md.txt index bd20f2c6..938e85f5 100644 --- a/_sources/quick_start/quant_aware_tutorial_en.md.txt +++ b/_sources/quick_start/quant_aware_tutorial_en.md.txt @@ -1,6 +1,6 @@ # Training-aware Quantization of image classification model - quick start -This tutorial shows how to do training-aware quantization using [API](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/docs/docs/api/quantization_api.md) in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections: +This tutorial shows how to do training-aware quantization using [API](https://paddlepaddle.github.io/PaddleSlim/api_en/paddleslim.quant.html#paddleslim.quant.quanter.quant_aware) in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections: 1. Necessary imports 2. Model architecture @@ -89,7 +89,7 @@ test(val_program) ## 4. Quantization -We call ``quant_aware`` API to add quantization and dequantization operators in ``train_program`` and ``val_program`` according to [default configuration](https://paddlepaddle.github.io/PaddleSlim/api/quantization_api/#_1). +We call ``quant_aware`` API to add quantization and dequantization operators in ``train_program`` and ``val_program`` according to [default configuration](https://paddlepaddle.github.io/PaddleSlim/api_cn/quantization_api.html#id2). ```python quant_program = slim.quant.quant_aware(train_program, exe.place, for_test=False) @@ -114,7 +114,7 @@ test(val_quant_program) ## 6. Save model after quantization -The model in ``4. Quantization`` after calling ``slim.quant.quant_aware`` API is only suitable to train. To get the inference model, we should use [slim.quant.convert](https://paddlepaddle.github.io/PaddleSlim/api/quantization_api/#convert) API to change model architecture and use [fluid.io.save_inference_model](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api_cn/io_cn/save_inference_model_cn.html#save-inference-model) to save model. ``float_prog``'s parameters are float32 dtype but in int8's range which can be used in ``fluid`` or ``paddle-lite``. ``paddle-lite`` will change the parameters' dtype from float32 to int8 first when loading the inference model. ``int8_prog``'s parameters are int8 dtype and we can get model size after quantization by saving it. ``int8_prog`` cannot be used in ``fluid`` or ``paddle-lite``. +The model in ``4. Quantization`` after calling ``slim.quant.quant_aware`` API is only suitable to train. To get the inference model, we should use [slim.quant.convert](https://paddlepaddle.github.io/PaddleSlim/api_en/paddleslim.quant.html#paddleslim.quant.quanter.convert) API to change model architecture and use [fluid.io.save_inference_model](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api_cn/io_cn/save_inference_model_cn.html#save-inference-model) to save model. ``float_prog``'s parameters are float32 dtype but in int8's range which can be used in ``fluid`` or ``paddle-lite``. ``paddle-lite`` will change the parameters' dtype from float32 to int8 first when loading the inference model. ``int8_prog``'s parameters are int8 dtype and we can get model size after quantization by saving it. ``int8_prog`` cannot be used in ``fluid`` or ``paddle-lite``. ```python diff --git a/_sources/quick_start/quant_post_tutorial.md.txt b/_sources/quick_start/quant_post_tutorial.md.txt index 84ec2cc0..5904b872 100644 --- a/_sources/quick_start/quant_post_tutorial.md.txt +++ b/_sources/quick_start/quant_post_tutorial.md.txt @@ -1,6 +1,6 @@ # 图像分类模型离线量化-快速开始 -该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的[离线量化接口](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/docs/docs/api/quantization_api.md)。 该示例包含以下步骤: +该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的[离线量化接口](https://paddlepaddle.github.io/PaddleSlim/api_cn/quantization_api.html#quant-post)。 该示例包含以下步骤: 1. 导入依赖 2. 构建模型 @@ -19,7 +19,7 @@ import numpy as np ``` ## 2. 构建网络 -该章节构造一个用于对MNIST数据进行分类的分类模型,选用`MobileNetV1`,并将输入大小设置为`[1, 28, 28]`,输出类别数为10。 为了方便展示示例,我们在`paddleslim.models`下预定义了用于构建分类模型的方法,执行以下代码构建分类模型: +该章节构造一个用于对MNIST数据进行分类的分类模型,选用`MobileNetV1`,并将输入大小设置为`[1, 28, 28]`,输出类别数为10。为了方便展示示例,我们在`paddleslim.models`下预定义了用于构建分类模型的方法,执行以下代码构建分类模型: >注意:paddleslim.models下的API并非PaddleSlim常规API,是为了简化示例而封装预定义的一系列方法,比如:模型结构的定义、Program的构建等。 @@ -60,7 +60,7 @@ def train(prog): if iter % 100 == 0: print('train', acc1.mean(), acc5.mean(), loss.mean()) iter += 1 - + def test(prog, outputs=outputs): iter = 0 res = [[], []] diff --git a/_sources/quick_start/quant_post_tutorial_en.md.txt b/_sources/quick_start/quant_post_tutorial_en.md.txt index aa599e61..a46329f3 100644 --- a/_sources/quick_start/quant_post_tutorial_en.md.txt +++ b/_sources/quick_start/quant_post_tutorial_en.md.txt @@ -1,6 +1,6 @@ # Post-training Quantization of image classification model - quick start -This tutorial shows how to do post training quantization using [API](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/docs/docs/api/quantization_api.md) in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections: +This tutorial shows how to do post training quantization using [API](https://paddlepaddle.github.io/PaddleSlim/api_en/paddleslim.quant.html#paddleslim.quant.quanter.quant_post) in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections: 1. Necessary imports 2. Model architecture diff --git a/algo/algo.html b/algo/algo.html index 359f04b2..3b4d5d2e 100644 --- a/algo/algo.html +++ b/algo/algo.html @@ -113,16 +113,16 @@
  • 3. 蒸馏
  • -
  • 4. 轻量级模型结构搜索 @@ -186,11 +186,11 @@

    1.1 背景

    近年来,定点量化使用更少的比特数(如8-bit、3-bit、2-bit等)表示神经网络的权重和激活已被验证是有效的。定点量化的优点包括低内存带宽、低功耗、低计算资源占用以及低模型存储需求等。

    -
    +
    表1: 不同类型操作的开销对比

    由表1可知,低精度定点数操作的硬件面积大小及能耗比高精度浮点数要少几个数量级。 使用定点量化可带来4倍的模型压缩、4倍的内存带宽提升,以及更高效的cache利用(很多硬件设备,内存访问是主要能耗)。除此之外,计算速度也会更快(通常具有2x-3x的性能提升)。由表2可知,在很多场景下,定点量化操作对精度并不会造成损失。另外,定点量化对神经网络于嵌入式设备上的推断来说是极其重要的。

    -
    +
    表2:模型量化前后精度对比

    目前,学术界主要将量化分为两大类:Post Training QuantizationQuantization Aware TrainingPost Training Quantization是指使用KL散度、滑动平均等方法确定量化参数且不需要重新训练的定点量化方法。Quantization Aware Training是在训练过程中对量化进行建模以确定量化参数,它与Post Training Quantization模式相比可以提供更高的预测精度。

    @@ -214,7 +214,7 @@ $q = scale * r + b$
    1.2.2.1 前向传播

    前向传播过程采用模拟量化的方式,具体描述如下:

    -
    +
    图1:基于模拟量化训练的前向过程

    由图1可知,基于模拟量化训练的前向过程可被描述为以下四个部分: 1) 输入和权重均被量化成8-bit整数。 @@ -232,7 +232,7 @@ Y{dq} = frac{Y_q}{(n - 1) * (n - 1)} * X_m * W_m =frac{X_q * W_q}{(n - 1) * $$ 上述公式表明反量化操作可以被移动到GEMM之前,即先对$Xq$和$Wq$执行反量化操作再做GEMM操作。因此,前向传播的工作流亦可表示为如下方式:

    -
    +
    图2:基于模拟量化训练前向过程的等价工作流

    训练过程中,PaddleSlim使用图2中所示的等价工作流。在设计中,量化Pass在IrGraph中插入量化op和反量化op。因为在连续的量化、反量化操作之后输入仍然为32-bit浮点型数据。因此,PaddleSlim量化训练框架所采用的量化方式被称为模拟量化。

    @@ -240,7 +240,7 @@ $$
    1.2.2.2 反向传播

    由图3可知,权重更新所需的梯度值可以由量化后的权重和量化后的激活求得。反向传播过程中的所有输入和输出均为32-bit浮点型数据。注意,梯度更新操作需要在原始权重上进行,即计算出的梯度将被加到原始权重上而非量化后或反量化后的权重上。

    -
    +
    图3:基于模拟量化训练的反向传播和权重更新过程

    因此,量化Pass也会改变相应反向算子的某些输入。

    @@ -282,20 +282,20 @@ $$

    剪裁注意事项1 剪裁一个conv layer的filter,需要修改后续conv layer的filter. 如图4所示,剪掉Xi的一个filter,会导致$X{i+1}$少一个channel, $X{i+1}$对应的filter在input_channel纬度上也要减1.

    -
    +
    图4

    剪裁注意事项2

    图5所示,剪裁完$Xi$之后,根据注意事项1我们从$X{i+1}$的filter中删除了一行(图中蓝色行),在计算$X_{i+1}$的filters的l1_norm(图中绿色一列)的时候,有两种选择: 算上被删除的一行:independent pruning 减去被删除的一行:greedy pruning

    -
    +
    图5

    剪裁注意事项3 在对ResNet等复杂网络剪裁的时候,还要考虑到后当前卷积层的修改对上一层卷积层的影响。 如图6所示,在对residual block剪裁时,$X{i+1}$层如何剪裁取决于project shortcut的剪裁结果,因为我们要保证project shortcut的output和$X{i+1}$的output能被正确的concat.

    -
    +
    图6

    @@ -323,7 +323,7 @@ $$

    敏感度的理解

    -
    +
    图7

    图7所示,横坐标是将filter剪裁掉的比例,竖坐标是精度的损失,每条彩色虚线表示的是网络中的一个卷积层。 以不同的剪裁比例单独剪裁一个卷积层,并观察其在验证数据集上的精度损失,并绘出图7中的虚线。虚线上升较慢的,对应的卷积层相对不敏感,我们优先剪不敏感的卷积层的filter.

    @@ -333,7 +333,7 @@ $$

    我们将图7中的折线拟合为图8中的曲线,每在竖坐标轴上选取一个精度损失值,就在横坐标轴上对应着一组剪裁率,如图8中黑色实线所示。 用户给定一个模型整体的剪裁率,我们通过移动图5中的黑色实线来找到一组满足条件的且合法的剪裁率。

    -
    +
    图8

    @@ -356,27 +356,24 @@ $$
    第一种是传统的蒸馏方法(参考论文:Distilling the Knowledge in a Neural Network

    使用复杂的网络作为teacher模型去监督训练一个参数量和运算量更少的student模型。teacher模型可以是一个或者多个提前训练好的高性能模型。student模型的训练有两个目标:一个是原始的目标函数,为student模型输出的类别概率和label的交叉熵,记为hard-target;另一个是student模型输出的类别概率和teacher模型输出的类别概率的交叉熵,记为soft target,这两个loss加权后得到最终的训练loss,共同监督studuent模型的训练。 -第二种是基于FSP的蒸馏方法(参考论文:`A Gift from Knowledge Distillation:

    +第二种是基于FSP的蒸馏方法(参考论文:A Gift from Knowledge Distillation: Fast Optimization, Network Minimization and Transfer Learning) +相比传统的蒸馏方法直接用小模型去拟合大模型的输出,该方法用小模型去拟合大模型不同层特征之间的转换关系,其用一个FSP矩阵(特征的内积)来表示不同层特征之间的关系,大模型和小模型不同层之间分别获得多个FSP矩阵,然后使用L2 loss让小模型的对应层FSP矩阵和大模型对应层的FSP矩阵尽量一致,具体如下图所示。这种方法的优势,通俗的解释是,比如将蒸馏类比成teacher(大模型)教student(小模型)解决一个问题,传统的蒸馏是直接告诉小模型问题的答案,让小模型学习,而学习FSP矩阵是让小模型学习解决问题的中间过程和方法,因此其学到的信息更多。

    -
    -
    Fast Optimization, Network Minimization and Transfer Learning <http://openaccess.thecvf.com/content_cvpr_2017/papers/Yim_A_Gift_From_CVPR_2017_paper.pdf>`_)
    -
    相比传统的蒸馏方法直接用小模型去拟合大模型的输出,该方法用小模型去拟合大模型不同层特征之间的转换关系,其用一个FSP矩阵(特征的内积)来表示不同层特征之间的关系,大模型和小模型不同层之间分别获得多个FSP矩阵,然后使用L2 loss让小模型的对应层FSP矩阵和大模型对应层的FSP矩阵尽量一致,具体如下图所示。这种方法的优势,通俗的解释是,比如将蒸馏类比成teacher(大模型)教student(小模型)解决一个问题,传统的蒸馏是直接告诉小模型问题的答案,让小模型学习,而学习FSP矩阵是让小模型学习解决问题的中间过程和方法,因此其学到的信息更多。
    -

    -
    +
    图9

    由于小模型和大模型之间通过L2 loss进行监督,必须保证两个FSP矩阵的维度必须相同,而FSP矩阵的维度为M*N,其中M、N分别为输入和输出特征的channel数,因此大模型和小模型的FSP矩阵需要一一对应。
    -
    -

    4. 轻量级模型结构搜索

    +
    +

    4. 轻量级模型结构搜索

    深度学习模型在很多任务上都取得了不错的效果,网络结构的好坏对最终模型的效果有非常重要的影响。手工设计网络需要非常丰富的经验和众多尝试,并且众多的超参数和网络结构参数会产生爆炸性的组合,常规的random search几乎不可行,因此最近几年自动模型搜索技术(Neural Architecture Search)成为研究热点。区别于传统NAS,我们专注在搜索精度高并且速度快的模型结构,我们将该功能统称为Light-NAS.

    -
    -

    4.1 搜索策略

    +
    +

    4.1 搜索策略

    搜索策略定义了使用怎样的算法可以快速、准确找到最优的网络结构参数配置。常见的搜索方法包括:强化学习、贝叶斯优化、进化算法、基于梯度的算法。我们当前的实现以模拟退火算法为主。

    -
    -

    4.1.1 模拟退火

    +
    +

    4.1.1 模拟退火

    模拟退火算法来源于固体退火原理,将固体加温至充分高,再让其徐徐冷却,加温时,固体内部粒子随温升变为无序状,内能增大,而徐徐冷却时粒子渐趋有序,在每个温度都达到平衡态,最后在常温时达到基态,内能减为最小。

    鉴于物理中固体物质的退火过程与一般组合优化问题之间的相似性,我们将其用于网络结构的搜索。

    使用模拟退火算法搜索模型的过程如下:

    @@ -393,16 +390,16 @@ end{equation}

    在我们的NAS任务中,区别于RL每次重新生成一个完整的网络,我们将网络结构映射成一段编码,第一次随机初始化,然后每次随机修改编码中的一部分(对应于网络结构的一部分)生成一个新的编码,然后将这个编码再映射回网络结构,通过在训练集上训练一定的epochs后的精度以及网络延时融合获得reward,来指导退火算法的收敛。

    -
    -

    4.2 搜索空间

    +
    +

    4.2 搜索空间

    搜索空间定义了优化问题的变量,变量规模决定了搜索算法的难度和搜索时间。因此为了加快搜索速度,定义一个合理的搜索空间至关重要。在Light-NAS中,为了加速搜索速度,我们将一个网络划分为多个block,先手动按链状层级结构堆叠c,再 使用搜索算法自动搜索每个block内部的结构。

    因为要搜索出在移动端运行速度快的模型,我们参考了MobileNetV2中的Linear Bottlenecks和Inverted residuals结构,搜索每一个Inverted residuals中的具体参数,包括kernelsize、channel扩张倍数、重复次数、channels number。如图10所示:

    -
    +
    图10

    -
    -

    4.3 模型延时评估

    +
    +

    4.3 模型延时评估

    搜索过程支持 FLOPS 约束和模型延时约束。而基于 Android/iOS 移动端、开发板等硬件平台,迭代搜索过程中不断测试模型的延时不仅消耗时间而且非常不方便,因此我们开发了模型延时评估器来评估搜索得到模型的延时。通过延时评估器评估得到的延时与模型实际测试的延时波动偏差小于 10%。

    延时评估器分为配置硬件延时评估器和评估模型延时两个阶段,配置硬件延时评估器只需要执行一次,而评估模型延时则在搜索过程中不断评估搜索得到的模型延时。

      @@ -419,8 +416,8 @@ end{equation}

    -
    -

    5. 参考文献

    +
    +

    5. 参考文献

    1. High-Performance Hardware for Machine Learning
    2. Quantizing deep convolutional networks for efficient inference: A whitepaper
    3. diff --git a/api_cn/nas_api.html b/api_cn/nas_api.html index a195a4d5..c49776df 100644 --- a/api_cn/nas_api.html +++ b/api_cn/nas_api.html @@ -155,7 +155,7 @@

      SA-NAS

      搜索空间参数的配置

      -

      通过参数配置搜索空间。更多搜索空间的使用可以参考: [search_space](../search_space.md)

      +

      通过参数配置搜索空间。更多搜索空间的使用可以参考: search_space

      参数:

      • input_size(int|None):- input_size 表示输入 feature map 的大小。 input_sizeoutput_size 用来计算整个模型结构中下采样次数。
      • @@ -257,6 +257,11 @@ sanas.reward(float(score))
    +
    +
    +tokens2arch(tokens)
    +
    +

    通过一组tokens得到实际的模型结构,一般用来把搜索到最优的token转换为模型结构用来做最后的训练。tokens的形式是一个列表,tokens映射到搜索空间转换成相应的网络结构,一组tokens对应唯一的一个网络结构。

    参数:

      diff --git a/api_cn/quantization_api.html b/api_cn/quantization_api.html index 3463c15b..488f0224 100644 --- a/api_cn/quantization_api.html +++ b/api_cn/quantization_api.html @@ -203,35 +203,36 @@
      • weight_quantize_type(str) - 参数量化方式。可选 'abs_max' , 'channel_wise_abs_max' , 'range_abs_max' , 'moving_average_abs_max' 。如果使用 TensorRT 加载量化后的模型来预测,请使用 'channel_wise_abs_max' 。 默认 'channel_wise_abs_max'
      • activation_quantize_type(str) - 激活量化方式,可选 'abs_max' , 'range_abs_max' , 'moving_average_abs_max' 。如果使用 TensorRT 加载量化后的模型来预测,请使用 'range_abs_max', 'moving_average_abs_max' 。,默认 'moving_average_abs_max'
      • -
      • weight_bits(int) - 参数量化bit数,默认8, 推荐设为8。
      • -
      • activation_bits(int) - 激活量化bit数,默认8, 推荐设为8。
      • -
      • not_quant_pattern(str | list[str]) - 所有 name_scope 包含 'not_quant_pattern' 字符串的 op ,都不量化, 设置方式请参考 fluid.name_scope
      • -
      • quantize_op_types(list[str]) - 需要进行量化的 op 类型,目前支持 'conv2d', 'depthwise_conv2d', 'mul'
      • +
      • weight_bits(int) - 参数量化bit数,默认8, 可选1-8,推荐设为8,因为量化后的数据类型是 int8
      • +
      • activation_bits(int) - 激活量化bit数,默认8,可选1-8,推荐设为8,因为量化后的数据类型是 int8
      • +
      • not_quant_pattern(str | list[str]) - 所有 name_scope 包含 'not_quant_pattern' 字符串的 op ,都不量化, 设置方式请参考 fluid.name_scope
      • +
      • quantize_op_types(list[str]) - 需要进行量化的 op 类型,目前支持 'conv2d', 'depthwise_conv2d', 'mul'
      • dtype(int8) - 量化后的参数类型,默认 int8 , 目前仅支持 int8
      • window_size(int) - 'range_abs_max' 量化方式的 window size ,默认10000。
      • moving_rate(int) - 'moving_average_abs_max' 量化方式的衰减系数,默认 0.9。
      • for_tensorrt(bool) - 量化后的模型是否使用 TensorRT 进行预测。如果是的话,量化op类型为: TENSORRT_OP_TYPES 。默认值为False.
      • -
      • is_full_quantize(bool) - 是否量化所有可支持op类型。默认值为False.
      • +
      • is_full_quantize(bool) - 是否量化所有可支持op类型。可量化op为 TRANSFORM_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES 。 默认值为False.

    quant_aware

    -paddleslim.quant.quant_aware(program, place, config, scope=None, for_test=False)[[源代码]](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/paddleslim/quant/quanter.py)
    +paddleslim.quant.quant_aware(program, place, config, scope=None, for_test=False)
    -

    program 中加入量化和反量化 op, 用于量化训练。

    +

    源代码

    +

    在 program 中加入量化和反量化op, 用于量化训练。

    参数:

      -
    • program (fluid.Program) - 传入训练或测试 program
    • +
    • program (fluid.Program) - 传入训练或测试program 。
    • place(fluid.CPUPlace | fluid.CUDAPlace) - 该参数表示 Executor 执行所在的设备。
    • config(dict) - 量化配置表。
    • scope(fluid.Scope, optional) - 传入用于存储 Variablescope ,需要传入 program 所使用的 scope ,一般情况下,是 fluid.global_scope() 。设置为 None 时将使用 fluid.global_scope() ,默认值为 None
    • -
    • for_test(bool) - 如果 program 参数是一个测试 programfor_test 应设为 True ,否则设为 False
    • +
    • for_test(bool) - 如果 program 参数是一个测试 programfor_test 应设为True,否则设为False 。

    返回

    -

    含有量化和反量化 operatorprogram

    +

    含有量化和反量化 operator 的 program 。

    返回类型

    • for_test=False ,返回类型为 fluid.CompiledProgram注意,此返回值不能用于保存参数
    • @@ -240,10 +241,10 @@

      注解

        -
      • 此接口会改变 program 结构,并且可能增加一些``persistable``的变量,所以加载模型参数时请注意和相应的``program``对应。
      • -
      • 此接口底层经历了``fluid.Program``-> fluid.framework.IrGraph->``fluid.Program``的转变,在``fluid.framework.IrGraph``中没有``Parameter``的概念,``Variable``只有``persistable``和``not persistable``的区别,所以在保存和加载参数时,请使用``fluid.io.save_persistables``和``fluid.io.load_persistables``接口。
      • -
      • 由于此接口会根据``program``的结构和量化配置来对``program``添加op,所以``Paddle``中一些通过``fuse op``来加速训练的策略不能使用。已知以下策略在使用量化时必须设为``False``: fuse_all_reduce_ops, sync_batch_norm
      • -
      • 如果传入的 program 中存在和任何op都没有连接的 Variable ,则会在量化的过程中被优化掉。
      • +
      • 此接口会改变program 结构,并且可能增加一些persistable的变量,所以加载模型参数时请注意和相应的 program 对应。
      • +
      • 此接口底层经历了 fluid.Program -> fluid.framework.IrGraph -> fluid.Program 的转变,在 fluid.framework.IrGraph 中没有 Parameter 的概念,Variable 只有 persistable 和not persistable的区别,所以在保存和加载参数时,请使用 fluid.io.save_persistablesfluid.io.load_persistables 接口。
      • +
      • 由于此接口会根据 program 的结构和量化配置来对program 添加op,所以 Paddle 中一些通过 fuse op 来加速训练的策略不能使用。已知以下策略在使用量化时必须设为False : fuse_all_reduce_ops, sync_batch_norm
      • +
      • 如果传入的 program 中存在和任何op都没有连接的 Variable ,则会在量化的过程中被优化掉。
    @@ -255,23 +256,23 @@

    源代码

    -

    把训练好的量化 program ,转换为可用于保存 inference modelprogram

    +

    把训练好的量化 program ,转换为可用于保存 inference model 的 program 。

    参数:

      -
    • program (fluid.Program) - 传入测试``program``。
    • -
    • place(fluid.CPUPlace | fluid.CUDAPlace) - 该参数表示``Executor``执行所在的设备。
    • +
    • program (fluid.Program) - 传入测试 program 。
    • +
    • place(fluid.CPUPlace | fluid.CUDAPlace) - 该参数表示 Executor 执行所在的设备。
    • config(dict) - 量化配置表。
    • -
    • scope(fluid.Scope) - 传入用于存储``Variable``的``scope``,需要传入``program``所使用的``scope``,一般情况下,是 fluid.global_scope() 。设置为 None 时将使用 fluid.global_scope() ,默认值为 None
    • -
    • save_int8(bool) - 是否需要返回参数为 int8program 。该功能目前只能用于确认模型大小。默认值为 False
    • +
    • scope(fluid.Scope) - 传入用于存储 Variablescope ,需要传入 program 所使用的 scope ,一般情况下,是 fluid.global_scope() 。设置为 None 时将使用 fluid.global_scope() ,默认值为 None
    • +
    • save_int8(bool) - 是否需要返回参数为 int8 的 program 。该功能目前只能用于确认模型大小。默认值为 False

    返回

      -
    • program (fluid.Program) - freezed program,可用于保存inference model,参数为``float32``类型,但其数值范围可用int8表示。
    • -
    • int8_program (fluid.Program) - freezed program,可用于保存inference model,参数为``int8``类型。当``save_int8``为``False``时,不返回该值。
    • +
    • program (fluid.Program) - freezed program,可用于保存inference model,参数为 float32 类型,但其数值范围可用int8表示。
    • +
    • int8_program (fluid.Program) - freezed program,可用于保存inference model,参数为 int8 类型。当 save_int8 为False 时,不返回该值。

    注解

    -

    因为该接口会对``op``和``Variable``做相应的删除和修改,所以此接口只能在训练完成之后调用。如果想转化训练的中间模型,可加载相应的参数之后再使用此接口。

    +

    因为该接口会对 op 和 Variable 做相应的删除和修改,所以此接口只能在训练完成之后调用。如果想转化训练的中间模型,可加载相应的参数之后再使用此接口。

    代码示例

    #encoding=utf8
    @@ -330,32 +331,32 @@
     
  • model_dir(str) - 需要量化的模型所在的文件夹。
  • quantize_model_path(str) - 保存量化后的模型的路径
  • sample_generator(python generator) - 读取数据样本,每次返回一个样本。
  • -
  • model_filename(str, optional) - 模型文件名,如果需要量化的模型的参数存在一个文件中,则需要设置``model_filename``为模型文件的名称,否则设置为``None``即可。默认值是``None``。
  • -
  • params_filename(str) - 参数文件名,如果需要量化的模型的参数存在一个文件中,则需要设置``params_filename``为参数文件的名称,否则设置为``None``即可。默认值是``None``。
  • +
  • model_filename(str, optional) - 模型文件名,如果需要量化的模型的参数存在一个文件中,则需要设置 model_filename 为模型文件的名称,否则设置为 None 即可。默认值是 None
  • +
  • params_filename(str) - 参数文件名,如果需要量化的模型的参数存在一个文件中,则需要设置 params_filename 为参数文件的名称,否则设置为 None 即可。默认值是 None
  • batch_size(int) - 每个batch的图片数量。默认值为16 。
  • -
  • batch_nums(int, optional) - 迭代次数。如果设置为``None``,则会一直运行到``sample_generator`` 迭代结束, 否则,迭代次数为``batch_nums``, 也就是说参与对 Scale 进行校正的样本个数为 'batch_nums' * 'batch_size' .
  • -
  • scope(fluid.Scope, optional) - 用来获取和写入 Variable , 如果设置为 None ,则使用 fluid.global_scope() . 默认值是``None``.
  • +
  • batch_nums(int, optional) - 迭代次数。如果设置为 None ,则会一直运行到 sample_generator 迭代结束, 否则,迭代次数为 batch_nums, 也就是说参与对 Scale 进行校正的样本个数为 'batch_nums' * 'batch_size' .
  • +
  • scope(fluid.Scope, optional) - 用来获取和写入 Variable , 如果设置为 None ,则使用 fluid.global_scope() . 默认值是 None .
  • algo(str) - 量化时使用的算法名称,可为 'KL' 或者 'direct' 。该参数仅针对激活值的量化,因为参数值的量化使用的方式为 'channel_wise_abs_max' . 当 algo 设置为 'direct' 时,使用校正数据的激活值的绝对值的最大值当作 Scale 值,当设置为 'KL' 时,则使用KL散度的方法来计算 Scale 值。默认值为 'KL'
  • -
  • quantizable_op_type(list[str]) - 需要量化的 op 类型列表。默认值为 ["conv2d", "depthwise_conv2d", "mul"]
  • -
  • is_full_quantize(bool) - 是否量化所有可支持的op类型。如果设置为False, 则按照 'quantizable_op_type' 的设置进行量化。
  • -
  • weight_bits(int) - weight的量化比特位数。
  • -
  • activation_bits(int) - 激活值的量化比特位数。
  • -
  • is_use_cache_file(bool) - 是否使用硬盘对中间结果进行存储。如果为False, 则将中间结果存储在内存中。
  • -
  • cache_dir(str) - 如果 'is_use_cache_file' 为True, 则将中间结果存储在此参数设置的路径下。
  • +
  • quantizable_op_type(list[str]) - 需要量化的 op 类型列表。默认值为 ["conv2d", "depthwise_conv2d", "mul"]
  • +
  • is_full_quantize(bool) - 是否量化所有可支持的op类型。如果设置为False, 则按照 'quantizable_op_type' 的设置进行量化。如果设置为True, 则按照 量化配置QUANT_DEQUANT_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES 定义的op进行量化。
  • +
  • weight_bits(int) - weight的量化比特位数, 默认值为8。
  • +
  • activation_bits(int) - 激活值的量化比特位数, 默认值为8。
  • +
  • is_use_cache_file(bool) - 是否使用硬盘对中间结果进行存储。如果为False, 则将中间结果存储在内存中。默认值为False。
  • +
  • cache_dir(str) - 如果 'is_use_cache_file' 为True, 则将中间结果存储在此参数设置的路径下。默认值为 ./temp_post_training
  • 返回

    无。

    注解

      -
    • 因为该接口会收集校正数据的所有的激活值,当校正图片比较多时,请设置``’is_use_cache_file’为True, 将中间结果存储在硬盘中。另外,‘KL’``散度的计算比较耗时。
    • -
    • 目前``Paddle-Lite``有int8 kernel来加速的op只有 ['conv2d', 'depthwise_conv2d', 'mul'], 其他op的int8 kernel将陆续支持。
    • +
    • 因为该接口会收集校正数据的所有的激活值,当校正图片比较多时,请设置 'is_use_cache_file' 为True, 将中间结果存储在硬盘中。另外,'KL' 散度的计算比较耗时。
    • +
    • 目前 Paddle-Lite 有int8 kernel来加速的op只有 ['conv2d', 'depthwise_conv2d', 'mul'] , 其他op的int8 kernel将陆续支持。

    代码示例

    警告

    -

    此示例不能直接运行,因为需要加载``${model_dir}``下的模型,所以不能直接运行。

    +

    此示例不能直接运行,因为需要加载 ${model_dir} 下的模型,所以不能直接运行。

    import paddle.fluid as fluid
     import paddle.dataset.mnist as reader
    @@ -390,14 +391,14 @@
     

    参数:

    • program(fluid.Program) - 需要量化的program
    • -
    • scope(fluid.Scope, optional) - 用来获取和写入``Variable``, 如果设置为``None``,则使用 fluid.global_scope() .
    • +
    • scope(fluid.Scope, optional) - 用来获取和写入 Variable, 如果设置为 None,则使用 fluid.global_scope() .
    • place(fluid.CPUPlace | fluid.CUDAPlace) - 运行program的设备
    • config(dict) - 定义量化的配置。可以配置的参数有:
      • 'params_name' (str, required): 需要进行量化的参数名称,此参数必须设置。
      • -
      • 'quantize_type' (str, optional): 量化的类型,目前支持的类型是 'abs_max', 待支持的类型有 'log', 'product_quantization' 。 默认值是``’abs_max’`` .
      • -
      • 'quantize_bits' (int, optional): 量化的 bit 数,目前支持的 bit 数为8。默认值是8.
      • +
      • 'quantize_type' (str, optional): 量化的类型,目前支持的类型是 'abs_max', 待支持的类型有 'log', 'product_quantization' 。 默认值是 'abs_max' .
      • +
      • 'quantize_bits' (int, optional): 量化的bit数,目前支持的bit数为8。默认值是8.
      • 'dtype' (str, optional): 量化之后的数据类型, 目前支持的是 'int8'. 默认值是 int8
      • 'threshold' (float, optional): 量化之前将根据此阈值对需要量化的参数值进行 clip. 如果不设置,则跳过 clip 过程直接量化。
      @@ -434,7 +435,7 @@ quant_program = quant.quant_embedding(infer_program, place, config)
    -

    更详细的用法请参考 Embedding量化demo

    +

    更详细的用法请参考 Embedding量化demo

    diff --git a/api_cn/search_space.html b/api_cn/search_space.html index 1ffb7526..f9457cf7 100644 --- a/api_cn/search_space.html +++ b/api_cn/search_space.html @@ -96,8 +96,12 @@
  • 量化
  • 简单蒸馏
  • 搜索空间
  • @@ -142,7 +146,7 @@
  • - View page source + View page source
  • @@ -157,121 +161,113 @@

    搜索空间是神经网络搜索中的一个概念。搜索空间是一系列模型结构的汇集, SANAS主要是利用模拟退火的思想在搜索空间中搜索到一个比较小的模型结构或者一个精度比较高的模型结构。

    paddleslim.nas 提供的搜索空间

    -

    根据初始模型结构构造搜索空间:

    -

    1. MobileNetV2Space<br> -&emsp; MobileNetV2的网络结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v2.py#L29),[论文](https://arxiv.org/abs/1801.04381)

    -

    2. MobileNetV1Space<br> -&emsp; MobilNetV1的网络结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v1.py#L29),[论文](https://arxiv.org/abs/1704.04861)

    -

    3. ResNetSpace<br> -&emsp; ResNetSpace的网络结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/resnet.py#L30),[论文](https://arxiv.org/pdf/1512.03385.pdf)

    -

    根据相应模型的block构造搜索空间: -1. MobileNetV1BlockSpace<br> -&emsp; MobileNetV1Block的结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v1.py#L173)

    -

    2. MobileNetV2BlockSpace<br> -&emsp; MobileNetV2Block的结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v2.py#L174)

    -

    3. ResNetBlockSpace<br> -&emsp; ResNetBlock的结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/resnet.py#L148)

    -

    4. InceptionABlockSpace<br> -&emsp; InceptionABlock的结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/inception_v4.py#L140)

    -

    5. InceptionCBlockSpace<br> -&emsp; InceptionCBlock结构可以参考:[代码](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/inception_v4.py#L291)

    -
    -

    搜索空间使用示例

    +

    根据初始模型结构构造搜索空间:

    +
      +
    1. MobileNetV2Space
      +&emsp; MobileNetV2的网络结构可以参考:代码论文
    2. +
    3. MobileNetV1Space
      +&emsp; MobilNetV1的网络结构可以参考:代码论文
    4. +
    5. ResNetSpace
      +&emsp; ResNetSpace的网络结构可以参考:代码论文
    6. +
    +
    +
    +

    根据相应模型的block构造搜索空间:

    +
      +
    1. MobileNetV1BlockSpace
      +&emsp; MobileNetV1Block的结构可以参考:代码
    2. +
    3. MobileNetV2BlockSpace
      +&emsp; MobileNetV2Block的结构可以参考:代码
    4. +
    5. ResNetBlockSpace
      +&emsp; ResNetBlock的结构可以参考:代码
    6. +
    7. InceptionABlockSpace
      +&emsp; InceptionABlock的结构可以参考:代码
    8. +
    9. InceptionCBlockSpace
      +&emsp; InceptionCBlock结构可以参考:代码
    10. +
    +
    + +
    +

    搜索空间使用示例

    1. 使用paddleslim中提供用初始的模型结构来构造搜索空间的话,仅需要指定搜索空间名字即可。例如:如果使用原本的MobileNetV2的搜索空间进行搜索的话,传入SANAS中的configs直接指定为[(‘MobileNetV2Space’)]。
    2. -
    3. 使用paddleslim中提供的block搜索空间构造搜索空间:<br>
    4. +
    5. 使用paddleslim中提供的block搜索空间构造搜索空间:
      +2.1 使用input_size, output_sizeblock_num来构造搜索空间。例如:传入SANAS的configs可以指定为[(‘MobileNetV2BlockSpace’, {‘input_size’: 224, ‘output_size’: 32, ‘block_num’: 10})]。
      +2.2 使用block_mask构造搜索空间。例如:传入SANAS的configs可以指定为[(‘MobileNetV2BlockSpace’, {‘block_mask’: [0, 1, 1, 1, 1, 0, 1, 0]})]。
    -
    -
    2.1 使用`input_size`, `output_size`和`block_num`来构造搜索空间。例如:传入SANAS的configs可以指定为[(‘MobileNetV2BlockSpace’, {‘input_size’: 224, ‘output_size’: 32, ‘block_num’: 10})]。<br> -2.2 使用`block_mask`构造搜索空间。例如:传入SANAS的configs可以指定为[(‘MobileNetV2BlockSpace’, {‘block_mask’: [0, 1, 1, 1, 1, 0, 1, 0]})]。

    自定义搜索空间(search space)

    -

    自定义搜索空间类需要继承搜索空间基类并重写以下几部分:<br> -&emsp; 1. 初始化的tokens(`init_tokens`函数),可以设置为自己想要的tokens列表, tokens列表中的每个数字指的是当前数字在相应的搜索列表中的索引。例如本示例中若tokens=[0, 3, 5],则代表当前模型结构搜索到的通道数为[8, 40, 128]。<br> -&emsp; 2. tokens中每个数字的搜索列表长度(`range_table`函数),tokens中每个token的索引范围。<br> -&emsp; 3. 根据tokens产生模型结构(`token2arch`函数),根据搜索到的tokens列表产生模型结构。 <br>

    +

    自定义搜索空间类需要继承搜索空间基类并重写以下几部分:
    +&emsp; 1. 初始化的tokens(init_tokens函数),可以设置为自己想要的tokens列表, tokens列表中的每个数字指的是当前数字在相应的搜索列表中的索引。例如本示例中若tokens=[0, 3, 5],则代表当前模型结构搜索到的通道数为[8, 40, 128]。
    +&emsp; 2. tokens中每个数字的搜索列表长度(range_table函数),tokens中每个token的索引范围。
    +&emsp; 3. 根据tokens产生模型结构(token2arch函数),根据搜索到的tokens列表产生模型结构。

    以新增reset block为例说明如何构造自己的search space。自定义的search space不能和已有的search space同名。

    -

    ```python -### 引入搜索空间基类函数和search space的注册类函数 -from .search_space_base import SearchSpaceBase -from .search_space_registry import SEARCHSPACE -import numpy as np

    -

    ### 需要调用注册函数把自定义搜索空间注册到space space中 -@SEARCHSPACE.register -### 定义一个继承SearchSpaceBase基类的搜索空间的类函数 -class ResNetBlockSpace2(SearchSpaceBase):

    -
    -
    -
    def __init__(self, input_size, output_size, block_num, block_mask):
    -
    ### 定义一些实际想要搜索的内容,例如:通道数、每个卷积的重复次数、卷积核大小等等 -### self.filter_num 代表通道数的搜索列表 -self.filter_num = np.array([8, 16, 32, 40, 64, 128, 256, 512])
    -
    -

    ### 定义初始化token,初始化token的长度根据传入的block_num或者block_mask的长度来得到的 -def init_tokens(self):

    -
    -
    return [0] * 3 * len(self.block_mask)
    -

    ### 定义token的index的取值范围 -def range_table(self):

    -
    -
    return [len(self.filter_num)] * 3 * len(self.block_mask)
    -

    ### 把token转换成模型结构 -def token2arch(self, tokens=None):

    -
    -
    -
    if tokens == None:
    -
    tokens = self.init_tokens()
    -
    -

    self.bottleneck_params_list = [] -for i in range(len(self.block_mask)):

    -
    -
    -
    self.bottleneck_params_list.append(self.filter_num[tokens[i * 3 + 0]],
    -
    self.filter_num[tokens[i * 3 + 1]], -self.filter_num[tokens[i * 3 + 2]], -2 if self.block_mask[i] == 1 else 1)
    -
    -
    -
    -
    def net_arch(input):
    -
    -
    for i, layer_setting in enumerate(self.bottleneck_params_list):
    -
    channel_num, stride = layer_setting[:-1], layer_setting[-1] -input = self._resnet_block(input, channel_num, stride, name=’resnet_layer{}’.format(i+1))
    -
    -

    return input

    -
    -
    -

    return net_arch

    -
    -

    ### 构造具体block的操作 -def _resnet_block(self, input, channel_num, stride, name=None):

    -
    -
    shortcut_conv = self._shortcut(input, channel_num[2], stride, name=name) -input = self._conv_bn_layer(input=input, num_filters=channel_num[0], filter_size=1, act=’relu’, name=name + ‘_conv0’) -input = self._conv_bn_layer(input=input, num_filters=channel_num[1], filter_size=3, stride=stride, act=’relu’, name=name + ‘_conv1’) -input = self._conv_bn_layer(input=input, num_filters=channel_num[2], filter_size=1, name=name + ‘_conv2’) -return fluid.layers.elementwise_add(x=shortcut_conv, y=input, axis=0, name=name+’_elementwise_add’)
    -
    -
    def _shortcut(self, input, channel_num, stride, name=None):
    -

    channel_in = input.shape[1] -if channel_in != channel_num or stride != 1:

    -
    -
    return self.conv_bn_layer(input, num_filters=channel_num, filter_size=1, stride=stride, name=name+’_shortcut’)
    -
    -
    else:
    -
    return input
    -
    -
    -
    def _conv_bn_layer(self, input, num_filters, filter_size, stride=1, padding=’SAME’, act=None, name=None):
    -
    conv = fluid.layers.conv2d(input, num_filters, filter_size, stride, name=name+’_conv’) -bn = fluid.layers.batch_norm(conv, act=act, name=name+’_bn’) -return bn
    -
    -
    -

    ```

    +
    ### 引入搜索空间基类函数和search space的注册类函数
    +from .search_space_base import SearchSpaceBase
    +from .search_space_registry import SEARCHSPACE
    +import numpy as np
    +
    +### 需要调用注册函数把自定义搜索空间注册到space space中
    +@SEARCHSPACE.register
    +### 定义一个继承SearchSpaceBase基类的搜索空间的类函数
    +class ResNetBlockSpace2(SearchSpaceBase):
    +    def __init__(self, input_size, output_size, block_num, block_mask):
    +        ### 定义一些实际想要搜索的内容,例如:通道数、每个卷积的重复次数、卷积核大小等等
    +        ### self.filter_num 代表通道数的搜索列表
    +        self.filter_num = np.array([8, 16, 32, 40, 64, 128, 256, 512])
    +
    +    ### 定义初始化token,初始化token的长度根据传入的block_num或者block_mask的长度来得到的
    +    def init_tokens(self):
    +        return [0] * 3 * len(self.block_mask)
    +
    +    ### 定义token的index的取值范围
    +    def range_table(self):
    +        return [len(self.filter_num)] * 3 * len(self.block_mask)
    +
    +    ### 把token转换成模型结构
    +    def token2arch(self, tokens=None):
    +        if tokens == None:
    +            tokens = self.init_tokens()
    +
    +        self.bottleneck_params_list = []
    +        for i in range(len(self.block_mask)):
    +            self.bottleneck_params_list.append(self.filter_num[tokens[i * 3 + 0]],
    +                                               self.filter_num[tokens[i * 3 + 1]],
    +                                               self.filter_num[tokens[i * 3 + 2]],
    +                                               2 if self.block_mask[i] == 1 else 1)
    +
    +        def net_arch(input):
    +            for i, layer_setting in enumerate(self.bottleneck_params_list):
    +                channel_num, stride = layer_setting[:-1], layer_setting[-1]
    +                input = self._resnet_block(input, channel_num, stride, name='resnet_layer{}'.format(i+1))
    +
    +            return input
    +
    +        return net_arch
    +
    +    ### 构造具体block的操作
    +    def _resnet_block(self, input, channel_num, stride, name=None):
    +        shortcut_conv = self._shortcut(input, channel_num[2], stride, name=name)
    +        input = self._conv_bn_layer(input=input, num_filters=channel_num[0], filter_size=1, act='relu', name=name + '_conv0')
    +        input = self._conv_bn_layer(input=input, num_filters=channel_num[1], filter_size=3, stride=stride, act='relu', name=name + '_conv1')
    +        input = self._conv_bn_layer(input=input, num_filters=channel_num[2], filter_size=1, name=name + '_conv2')
    +        return fluid.layers.elementwise_add(x=shortcut_conv, y=input, axis=0, name=name+'_elementwise_add')
    +
    +    def _shortcut(self, input, channel_num, stride, name=None):
    +        channel_in = input.shape[1]
    +        if channel_in != channel_num or stride != 1:
    +            return self.conv_bn_layer(input, num_filters=channel_num, filter_size=1, stride=stride, name=name+'_shortcut')
    +        else:
    +            return input
    +
    +    def _conv_bn_layer(self, input, num_filters, filter_size, stride=1, padding='SAME', act=None, name=None):
    +        conv = fluid.layers.conv2d(input, num_filters, filter_size, stride, name=name+'_conv')
    +        bn = fluid.layers.batch_norm(conv, act=act, name=name+'_bn')
    +        return bn
    +
    +
    diff --git a/api_en/search_space_en.html b/api_en/search_space_en.html index b3866466..892b370f 100644 --- a/api_en/search_space_en.html +++ b/api_en/search_space_en.html @@ -96,7 +96,11 @@
  • paddleslim.nas.one_shot package
  • paddleslim.pantheon package
  • search space @@ -141,7 +145,7 @@
  • - View page source + View page source
  • @@ -156,121 +160,113 @@

    Search Space used in neural architecture search. Search Space is a collection of model architecture, the purpose of SANAS is to get a model which FLOPs or latency is smaller or percision is higher.

    search space which paddleslim.nas provided

    -

    Based on origin model architecture: -1. MobileNetV2Space<br> -&emsp; MobileNetV2’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v2.py#L29), [paper](https://arxiv.org/abs/1801.04381)

    -

    2. MobileNetV1Space<br> -&emsp; MobilNetV1’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v1.py#L29), [paper](https://arxiv.org/abs/1704.04861)

    -

    3. ResNetSpace<br> -&emsp; ResNetSpace’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/resnet.py#L30), [paper](https://arxiv.org/pdf/1512.03385.pdf)

    -

    Based on block from different model: -1. MobileNetV1BlockSpace<br> -&emsp; MobileNetV1Block’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v1.py#L173)

    -

    2. MobileNetV2BlockSpace<br> -&emsp; MobileNetV2Block’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/mobilenet_v2.py#L174)

    -

    3. ResNetBlockSpace<br> -&emsp; ResNetBlock’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/resnet.py#L148)

    -

    4. InceptionABlockSpace<br> -&emsp; InceptionABlock’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/inception_v4.py#L140)

    -

    5. InceptionCBlockSpace<br> -&emsp; InceptionCBlock’s architecture can reference: [code](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/image_classification/models/inception_v4.py#L291)

    +
    +

    Based on origin model architecture:

    +
      +
    1. MobileNetV2Space
      +&emsp; MobileNetV2’s architecture can reference: code, paper
    2. +
    3. MobileNetV1Space
      +&emsp; MobilNetV1’s architecture can reference: code, paper
    4. +
    5. ResNetSpace
      +&emsp; ResNetSpace’s architecture can reference: code, paper
    6. +
    +
    +
    +

    Based on block from different model:

    +
      +
    1. MobileNetV1BlockSpace
      +&emsp; MobileNetV1Block’s architecture can reference: code
    2. +
    3. MobileNetV2BlockSpace
      +&emsp; MobileNetV2Block’s architecture can reference: code
    4. +
    5. ResNetBlockSpace
      +&emsp; ResNetBlock’s architecture can reference: code
    6. +
    7. InceptionABlockSpace
      +&emsp; InceptionABlock’s architecture can reference: code
    8. +
    9. InceptionCBlockSpace
      +&emsp; InceptionCBlock’s architecture can reference: code
    10. +
    +

    How to use search space

    1. Only need to specify the name of search space if use the space based on origin model architecture, such as configs for class SANAS is [(‘MobileNetV2Space’)] if you want to use origin MobileNetV2 as search space.
    2. -
    3. Use search space paddleslim.nas provided based on block:<br>
    4. +
    5. Use search space paddleslim.nas provided based on block:
      +2.1 Use input_size, output_size and block_num to construct search space, such as configs for class SANAS is (‘MobileNetV2BlockSpace’, {‘input_size’: 224, ‘output_size’: 32, ‘block_num’: 10})].
      +2.2 Use block_mask to construct search space, such as configs for class SANAS is [(‘MobileNetV2BlockSpace’, {‘block_mask’: [0, 1, 1, 1, 1, 0, 1, 0]})].
    -
    -
    2.1 Use input_size, output_size and block_num to construct search space, such as configs for class SANAS is (‘MobileNetV2BlockSpace’, {‘input_size’: 224, ‘output_size’: 32, ‘block_num’: 10})].<br> -2.2 Use block_mask to construct search space, such as configs for class SANAS is [(‘MobileNetV2BlockSpace’, {‘block_mask’: [0, 1, 1, 1, 1, 0, 1, 0]})].

    How to write yourself search space

    -

    If you want to write yourself search space, you need to inherit base class named SearchSpaceBase and overwrite following functions:<br> -&emsp; 1. Function to get initial tokens(function init_tokens), set the initial tokens which you want, every token in tokens means index of search list, such as if tokens=[0, 3, 5], it means the list of channel of current model architecture is [8, 40, 128]. -&emsp; 2. Function about the length of every token in tokens(function range_table), range of every token in tokens. -&emsp; 3. Function to get model architecture according to tokens(function token2arch), get model architecture according to tokens in the search process.

    +

    If you want to write yourself search space, you need to inherit base class named SearchSpaceBase and overwrite following functions:
    +&emsp; 1. Function to get initial tokens(function init_tokens), set the initial tokens which you want, every token in tokens means index of search list, such as if tokens=[0, 3, 5], it means the list of channel of current model architecture is [8, 40, 128]. +&emsp; 2. Function about the length of every token in tokens(function range_table), range of every token in tokens. +&emsp; 3. Function to get model architecture according to tokens(function token2arch), get model architecture according to tokens in the search process.

    For example, how to add a search space with resnet block. New search space can NOT has the same name with existing search space.

    -

    ```python -### import necessary head file -from .search_space_base import SearchSpaceBase -from .search_space_registry import SEARCHSPACE -import numpy as np

    -

    ### use decorator SEARCHSPACE.register to register yourself search space to search space NameSpace -@SEARCHSPACE.register -### define a search space class inherit the base class SearchSpaceBase -class ResNetBlockSpace2(SearchSpaceBase):

    -
    -
    -
    def __init__(self, input_size, output_size, block_num, block_mask):
    -
    ### define the iterm you want to search, such as the numeber of channel, the number of convolution repeat, the size of kernel. -### self.filter_num represents the search list about the numeber of channel. -self.filter_num = np.array([8, 16, 32, 40, 64, 128, 256, 512])
    -
    -

    ### define initial tokens, the length of initial tokens according to block_num or block_mask. -def init_tokens(self):

    -
    -
    return [0] * 3 * len(self.block_mask)
    -

    ### define the range of index in tokens. -def range_table(self):

    -
    -
    return [len(self.filter_num)] * 3 * len(self.block_mask)
    -

    ### transform tokens to model architecture. -def token2arch(self, tokens=None):

    -
    -
    -
    if tokens == None:
    -
    tokens = self.init_tokens()
    -
    -

    self.bottleneck_params_list = [] -for i in range(len(self.block_mask)):

    -
    -
    -
    self.bottleneck_params_list.append(self.filter_num[tokens[i * 3 + 0]],
    -
    self.filter_num[tokens[i * 3 + 1]], -self.filter_num[tokens[i * 3 + 2]], -2 if self.block_mask[i] == 1 else 1)
    -
    -
    -
    -
    def net_arch(input):
    -
    -
    for i, layer_setting in enumerate(self.bottleneck_params_list):
    -
    channel_num, stride = layer_setting[:-1], layer_setting[-1] -input = self._resnet_block(input, channel_num, stride, name=’resnet_layer{}’.format(i+1))
    -
    -

    return input

    -
    -
    -

    return net_arch

    -
    -

    ### code to get block. -def _resnet_block(self, input, channel_num, stride, name=None):

    -
    -
    shortcut_conv = self._shortcut(input, channel_num[2], stride, name=name) -input = self._conv_bn_layer(input=input, num_filters=channel_num[0], filter_size=1, act=’relu’, name=name + ‘_conv0’) -input = self._conv_bn_layer(input=input, num_filters=channel_num[1], filter_size=3, stride=stride, act=’relu’, name=name + ‘_conv1’) -input = self._conv_bn_layer(input=input, num_filters=channel_num[2], filter_size=1, name=name + ‘_conv2’) -return fluid.layers.elementwise_add(x=shortcut_conv, y=input, axis=0, name=name+’_elementwise_add’)
    -
    -
    def _shortcut(self, input, channel_num, stride, name=None):
    -

    channel_in = input.shape[1] -if channel_in != channel_num or stride != 1:

    -
    -
    return self.conv_bn_layer(input, num_filters=channel_num, filter_size=1, stride=stride, name=name+’_shortcut’)
    -
    -
    else:
    -
    return input
    -
    -
    -
    def _conv_bn_layer(self, input, num_filters, filter_size, stride=1, padding=’SAME’, act=None, name=None):
    -
    conv = fluid.layers.conv2d(input, num_filters, filter_size, stride, name=name+’_conv’) -bn = fluid.layers.batch_norm(conv, act=act, name=name+’_bn’) -return bn
    -
    -
    -

    ```

    +
    ### import necessary head file
    +from .search_space_base import SearchSpaceBase
    +from .search_space_registry import SEARCHSPACE
    +import numpy as np
    +
    +### use decorator SEARCHSPACE.register to register yourself search space to search space NameSpace
    +@SEARCHSPACE.register
    +### define a search space class inherit the base class SearchSpaceBase
    +class ResNetBlockSpace2(SearchSpaceBase):
    +    def __init__(self, input_size, output_size, block_num, block_mask):
    +        ### define the iterm you want to search, such as the numeber of channel, the number of convolution repeat, the size of kernel.
    +        ### self.filter_num represents the search list about the numeber of channel.
    +        self.filter_num = np.array([8, 16, 32, 40, 64, 128, 256, 512])
    +
    +    ### define initial tokens, the length of initial tokens according to block_num or block_mask.
    +    def init_tokens(self):
    +        return [0] * 3 * len(self.block_mask)
    +
    +    ### define the range of index in tokens.
    +    def range_table(self):
    +        return [len(self.filter_num)] * 3 * len(self.block_mask)
    +
    +    ### transform tokens to model architecture.
    +    def token2arch(self, tokens=None):
    +        if tokens == None:
    +            tokens = self.init_tokens()
    +
    +        self.bottleneck_params_list = []
    +        for i in range(len(self.block_mask)):
    +            self.bottleneck_params_list.append(self.filter_num[tokens[i * 3 + 0]],
    +                                               self.filter_num[tokens[i * 3 + 1]],
    +                                               self.filter_num[tokens[i * 3 + 2]],
    +                                               2 if self.block_mask[i] == 1 else 1)
    +
    +        def net_arch(input):
    +            for i, layer_setting in enumerate(self.bottleneck_params_list):
    +                channel_num, stride = layer_setting[:-1], layer_setting[-1]
    +                input = self._resnet_block(input, channel_num, stride, name='resnet_layer{}'.format(i+1))
    +
    +            return input
    +
    +        return net_arch
    +
    +    ### code to get block.
    +    def _resnet_block(self, input, channel_num, stride, name=None):
    +        shortcut_conv = self._shortcut(input, channel_num[2], stride, name=name)
    +        input = self._conv_bn_layer(input=input, num_filters=channel_num[0], filter_size=1, act='relu', name=name + '_conv0')
    +        input = self._conv_bn_layer(input=input, num_filters=channel_num[1], filter_size=3, stride=stride, act='relu', name=name + '_conv1')
    +        input = self._conv_bn_layer(input=input, num_filters=channel_num[2], filter_size=1, name=name + '_conv2')
    +        return fluid.layers.elementwise_add(x=shortcut_conv, y=input, axis=0, name=name+'_elementwise_add')
    +
    +    def _shortcut(self, input, channel_num, stride, name=None):
    +        channel_in = input.shape[1]
    +        if channel_in != channel_num or stride != 1:
    +            return self.conv_bn_layer(input, num_filters=channel_num, filter_size=1, stride=stride, name=name+'_shortcut')
    +        else:
    +            return input
    +
    +    def _conv_bn_layer(self, input, num_filters, filter_size, stride=1, padding='SAME', act=None, name=None):
    +        conv = fluid.layers.conv2d(input, num_filters, filter_size, stride, name=name+'_conv')
    +        bn = fluid.layers.batch_norm(conv, act=act, name=name+'_bn')
    +        return bn
    +
    +
    diff --git a/quick_start/quant_aware_tutorial.html b/quick_start/quant_aware_tutorial.html index 7a4169a3..1efced59 100644 --- a/quick_start/quant_aware_tutorial.html +++ b/quick_start/quant_aware_tutorial.html @@ -157,7 +157,7 @@

    图像分类模型量化训练-快速开始

    -

    该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的量化训练接口。 该示例包含以下步骤:

    +

    该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的量化训练接口。 该示例包含以下步骤:

    1. 导入依赖
    2. 构建模型
    3. @@ -238,7 +238,7 @@

    4. 量化

    -

    按照默认配置train_programval_program中加入量化和反量化op.

    +

    按照默认配置train_programval_program中加入量化和反量化op.

    quant_program = slim.quant.quant_aware(train_program, exe.place, for_test=False)
     val_quant_program = slim.quant.quant_aware(val_program, exe.place, for_test=True)
     
    @@ -257,7 +257,7 @@

    6. 保存量化后的模型

    -

    4. 量化中使用接口slim.quant.quant_aware接口得到的模型只适合训练时使用,为了得到最终使用时的模型,需要使用slim.quant.convert接口,然后使用fluid.io.save_inference_model保存模型。float_prog的参数数据类型是float32,但是数据范围是int8, 保存之后可使用fluid或者paddle-lite加载使用,paddle-lite在使用时,会先将类型转换为int8。int8_prog的参数数据类型是int8, 保存后可看到量化后模型大小,不可加载使用。

    +

    4. 量化中使用接口slim.quant.quant_aware接口得到的模型只适合训练时使用,为了得到最终使用时的模型,需要使用slim.quant.convert接口,然后使用fluid.io.save_inference_model保存模型。float_prog的参数数据类型是float32,但是数据范围是int8, 保存之后可使用fluid或者paddle-lite加载使用,paddle-lite在使用时,会先将类型转换为int8。int8_prog的参数数据类型是int8, 保存后可看到量化后模型大小,不可加载使用。

    float_prog, int8_prog = slim.quant.convert(val_quant_program, exe.place, save_int8=True)
     target_vars = [float_prog.global_block().var(name) for name in outputs]
     fluid.io.save_inference_model(dirname='./inference_model/float',
    diff --git a/quick_start/quant_aware_tutorial_en.html b/quick_start/quant_aware_tutorial_en.html
    index 59a5a2d6..8686341b 100644
    --- a/quick_start/quant_aware_tutorial_en.html
    +++ b/quick_start/quant_aware_tutorial_en.html
    @@ -155,7 +155,7 @@
                 
       

    Training-aware Quantization of image classification model - quick start

    -

    This tutorial shows how to do training-aware quantization using API in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections:

    +

    This tutorial shows how to do training-aware quantization using API in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections:

    1. Necessary imports
    2. Model architecture
    3. @@ -235,7 +235,7 @@

    4. Quantization

    -

    We call quant_aware API to add quantization and dequantization operators in train_program and val_program according to default configuration.

    +

    We call quant_aware API to add quantization and dequantization operators in train_program and val_program according to default configuration.

    quant_program = slim.quant.quant_aware(train_program, exe.place, for_test=False)
     val_quant_program = slim.quant.quant_aware(val_program, exe.place, for_test=True)
     
    @@ -254,7 +254,7 @@

    6. Save model after quantization

    -

    The model in 4. Quantization after calling slim.quant.quant_aware API is only suitable to train. To get the inference model, we should use slim.quant.convert API to change model architecture and use fluid.io.save_inference_model to save model. float_prog‘s parameters are float32 dtype but in int8’s range which can be used in fluid or paddle-lite. paddle-lite will change the parameters’ dtype from float32 to int8 first when loading the inference model. int8_prog‘s parameters are int8 dtype and we can get model size after quantization by saving it. int8_prog cannot be used in fluid or paddle-lite.

    +

    The model in 4. Quantization after calling slim.quant.quant_aware API is only suitable to train. To get the inference model, we should use slim.quant.convert API to change model architecture and use fluid.io.save_inference_model to save model. float_prog‘s parameters are float32 dtype but in int8’s range which can be used in fluid or paddle-lite. paddle-lite will change the parameters’ dtype from float32 to int8 first when loading the inference model. int8_prog‘s parameters are int8 dtype and we can get model size after quantization by saving it. int8_prog cannot be used in fluid or paddle-lite.

    float_prog, int8_prog = slim.quant.convert(val_quant_program, exe.place, save_int8=True)
     target_vars = [float_prog.global_block().var(name) for name in outputs]
     fluid.io.save_inference_model(dirname='./inference_model/float',
    diff --git a/quick_start/quant_post_tutorial.html b/quick_start/quant_post_tutorial.html
    index abb12e1b..d0f5a716 100644
    --- a/quick_start/quant_post_tutorial.html
    +++ b/quick_start/quant_post_tutorial.html
    @@ -155,7 +155,7 @@
                 
       

    图像分类模型离线量化-快速开始

    -

    该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的离线量化接口。 该示例包含以下步骤:

    +

    该教程以图像分类模型MobileNetV1为例,说明如何快速使用PaddleSlim的离线量化接口。 该示例包含以下步骤:

    1. 导入依赖
    2. 构建模型
    3. @@ -174,7 +174,7 @@

    2. 构建网络

    -

    该章节构造一个用于对MNIST数据进行分类的分类模型,选用MobileNetV1,并将输入大小设置为[1, 28, 28],输出类别数为10。 为了方便展示示例,我们在paddleslim.models下预定义了用于构建分类模型的方法,执行以下代码构建分类模型:

    +

    该章节构造一个用于对MNIST数据进行分类的分类模型,选用MobileNetV1,并将输入大小设置为[1, 28, 28],输出类别数为10。为了方便展示示例,我们在paddleslim.models下预定义了用于构建分类模型的方法,执行以下代码构建分类模型:

    注意:paddleslim.models下的API并非PaddleSlim常规API,是为了简化示例而封装预定义的一系列方法,比如:模型结构的定义、Program的构建等。
    exe, train_program, val_program, inputs, outputs = \
    diff --git a/quick_start/quant_post_tutorial_en.html b/quick_start/quant_post_tutorial_en.html
    index 552407f0..b21e1052 100644
    --- a/quick_start/quant_post_tutorial_en.html
    +++ b/quick_start/quant_post_tutorial_en.html
    @@ -153,7 +153,7 @@
                 
       

    Post-training Quantization of image classification model - quick start

    -

    This tutorial shows how to do post training quantization using API in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections:

    +

    This tutorial shows how to do post training quantization using API in PaddleSlim. We use MobileNetV1 to train image classification model as example. The tutorial contains follow sections:

    1. Necessary imports
    2. Model architecture
    3. diff --git a/searchindex.js b/searchindex.js index d65fa546..28a882d9 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["api_en/index_en","api_en/modules","api_en/paddleslim","api_en/paddleslim.analysis","api_en/paddleslim.common","api_en/paddleslim.core","api_en/paddleslim.dist","api_en/paddleslim.models","api_en/paddleslim.nas","api_en/paddleslim.nas.one_shot","api_en/paddleslim.pantheon","api_en/paddleslim.prune","api_en/paddleslim.quant","api_en/search_space_en","api_en/table_latency_en","index","index_en","install_en","intro_en","model_zoo_en","quick_start/distillation_tutorial_en","quick_start/index_en","quick_start/nas_tutorial_en","quick_start/pruning_tutorial_en","quick_start/quant_aware_tutorial_en","quick_start/quant_post_tutorial_en","tutorials/image_classification_sensitivity_analysis_tutorial_en","tutorials/index_en"],envversion:50,filenames:["api_en/index_en.rst","api_en/modules.rst","api_en/paddleslim.rst","api_en/paddleslim.analysis.rst","api_en/paddleslim.common.rst","api_en/paddleslim.core.rst","api_en/paddleslim.dist.rst","api_en/paddleslim.models.rst","api_en/paddleslim.nas.rst","api_en/paddleslim.nas.one_shot.rst","api_en/paddleslim.pantheon.rst","api_en/paddleslim.prune.rst","api_en/paddleslim.quant.rst","api_en/search_space_en.rst","api_en/table_latency_en.md","index.rst","index_en.rst","install_en.md","intro_en.md","model_zoo_en.md","quick_start/distillation_tutorial_en.md","quick_start/index_en.rst","quick_start/nas_tutorial_en.md","quick_start/pruning_tutorial_en.md","quick_start/quant_aware_tutorial_en.md","quick_start/quant_post_tutorial_en.md","tutorials/image_classification_sensitivity_analysis_tutorial_en.md","tutorials/index_en.rst"],objects:{"":{paddleslim:[2,0,0,"-"]},"paddleslim.analysis":{LatencyEvaluator:[3,1,1,""],TableLatencyEvaluator:[3,1,1,""],flops:[3,0,0,"-"],latency:[3,0,0,"-"],model_size:[3,0,0,"-"]},"paddleslim.analysis.LatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.TableLatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.flops":{flops:[3,3,1,""]},"paddleslim.analysis.latency":{LatencyEvaluator:[3,1,1,""],TableLatencyEvaluator:[3,1,1,""]},"paddleslim.analysis.latency.LatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.latency.TableLatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.model_size":{model_size:[3,3,1,""]},"paddleslim.common":{ControllerClient:[4,1,1,""],ControllerServer:[4,1,1,""],EvolutionaryController:[4,1,1,""],SAController:[4,1,1,""],cached_reader:[4,0,0,"-"],controller:[4,0,0,"-"],controller_client:[4,0,0,"-"],controller_server:[4,0,0,"-"],get_logger:[4,3,1,""],lock:[4,0,0,"-"],log_helper:[4,0,0,"-"],sa_controller:[4,0,0,"-"],unlock:[4,3,1,""]},"paddleslim.common.ControllerClient":{next_tokens:[4,2,1,""],request_current_info:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.ControllerServer":{close:[4,2,1,""],ip:[4,2,1,""],port:[4,2,1,""],run:[4,2,1,""],start:[4,2,1,""]},"paddleslim.common.EvolutionaryController":{next_tokens:[4,2,1,""],reset:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.SAController":{best_tokens:[4,4,1,""],current_tokens:[4,4,1,""],max_reward:[4,4,1,""],next_tokens:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.cached_reader":{cached_reader:[4,3,1,""]},"paddleslim.common.controller":{EvolutionaryController:[4,1,1,""]},"paddleslim.common.controller.EvolutionaryController":{next_tokens:[4,2,1,""],reset:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.controller_client":{ControllerClient:[4,1,1,""]},"paddleslim.common.controller_client.ControllerClient":{next_tokens:[4,2,1,""],request_current_info:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.controller_server":{ControllerServer:[4,1,1,""]},"paddleslim.common.controller_server.ControllerServer":{close:[4,2,1,""],ip:[4,2,1,""],port:[4,2,1,""],run:[4,2,1,""],start:[4,2,1,""]},"paddleslim.common.lock":{lock:[4,3,1,""],unlock:[4,3,1,""]},"paddleslim.common.log_helper":{get_logger:[4,3,1,""]},"paddleslim.common.sa_controller":{SAController:[4,1,1,""]},"paddleslim.common.sa_controller.SAController":{best_tokens:[4,4,1,""],current_tokens:[4,4,1,""],max_reward:[4,4,1,""],next_tokens:[4,2,1,""],update:[4,2,1,""]},"paddleslim.core":{GraphWrapper:[5,1,1,""],OpWrapper:[5,1,1,""],Registry:[5,1,1,""],VarWrapper:[5,1,1,""],graph_wrapper:[5,0,0,"-"],registry:[5,0,0,"-"]},"paddleslim.core.GraphWrapper":{"var":[5,2,1,""],all_parameters:[5,2,1,""],clone:[5,2,1,""],get_param_by_op:[5,2,1,""],infer_shape:[5,2,1,""],is_parameter:[5,2,1,""],is_persistable:[5,2,1,""],next_ops:[5,2,1,""],numel_params:[5,2,1,""],ops:[5,2,1,""],pre_ops:[5,2,1,""],program:[5,2,1,""],update_groups_of_conv:[5,2,1,""],update_param_shape:[5,2,1,""],vars:[5,2,1,""]},"paddleslim.core.OpWrapper":{all_inputs:[5,2,1,""],all_outputs:[5,2,1,""],attr:[5,2,1,""],idx:[5,2,1,""],inputs:[5,2,1,""],is_bwd_op:[5,2,1,""],is_opt_op:[5,2,1,""],outputs:[5,2,1,""],set_attr:[5,2,1,""],type:[5,2,1,""]},"paddleslim.core.Registry":{get:[5,2,1,""],module_dict:[5,4,1,""],name:[5,4,1,""],register:[5,2,1,""]},"paddleslim.core.VarWrapper":{inputs:[5,2,1,""],is_parameter:[5,2,1,""],name:[5,2,1,""],outputs:[5,2,1,""],set_shape:[5,2,1,""],shape:[5,2,1,""]},"paddleslim.core.graph_wrapper":{GraphWrapper:[5,1,1,""],OpWrapper:[5,1,1,""],VarWrapper:[5,1,1,""]},"paddleslim.core.graph_wrapper.GraphWrapper":{"var":[5,2,1,""],all_parameters:[5,2,1,""],clone:[5,2,1,""],get_param_by_op:[5,2,1,""],infer_shape:[5,2,1,""],is_parameter:[5,2,1,""],is_persistable:[5,2,1,""],next_ops:[5,2,1,""],numel_params:[5,2,1,""],ops:[5,2,1,""],pre_ops:[5,2,1,""],program:[5,2,1,""],update_groups_of_conv:[5,2,1,""],update_param_shape:[5,2,1,""],vars:[5,2,1,""]},"paddleslim.core.graph_wrapper.OpWrapper":{all_inputs:[5,2,1,""],all_outputs:[5,2,1,""],attr:[5,2,1,""],idx:[5,2,1,""],inputs:[5,2,1,""],is_bwd_op:[5,2,1,""],is_opt_op:[5,2,1,""],outputs:[5,2,1,""],set_attr:[5,2,1,""],type:[5,2,1,""]},"paddleslim.core.graph_wrapper.VarWrapper":{inputs:[5,2,1,""],is_parameter:[5,2,1,""],name:[5,2,1,""],outputs:[5,2,1,""],set_shape:[5,2,1,""],shape:[5,2,1,""]},"paddleslim.core.registry":{Registry:[5,1,1,""]},"paddleslim.core.registry.Registry":{get:[5,2,1,""],module_dict:[5,4,1,""],name:[5,4,1,""],register:[5,2,1,""]},"paddleslim.dist":{single_distiller:[6,0,0,"-"]},"paddleslim.dist.single_distiller":{fsp_loss:[6,3,1,""],l2_loss:[6,3,1,""],loss:[6,3,1,""],merge:[6,3,1,""],soft_label_loss:[6,3,1,""]},"paddleslim.models":{classification_models:[7,0,0,"-"],image_classification:[7,3,1,""],mobilenet:[7,0,0,"-"],mobilenet_v2:[7,0,0,"-"],resnet:[7,0,0,"-"],util:[7,0,0,"-"]},"paddleslim.models.classification_models":{MobileNet:[7,1,1,""],MobileNetV2:[7,1,1,""],ResNet34:[7,3,1,""],ResNet50:[7,3,1,""]},"paddleslim.models.classification_models.MobileNet":{conv_bn_layer:[7,2,1,""],depthwise_separable:[7,2,1,""],net:[7,2,1,""]},"paddleslim.models.classification_models.MobileNetV2":{conv_bn_layer:[7,2,1,""],inverted_residual_unit:[7,2,1,""],invresi_blocks:[7,2,1,""],net:[7,2,1,""],shortcut:[7,2,1,""]},"paddleslim.models.mobilenet":{MobileNet:[7,1,1,""]},"paddleslim.models.mobilenet.MobileNet":{conv_bn_layer:[7,2,1,""],depthwise_separable:[7,2,1,""],net:[7,2,1,""]},"paddleslim.models.mobilenet_v2":{MobileNetV2:[7,1,1,""],MobileNetV2_scale:[7,3,1,""],MobileNetV2_x1_0:[7,3,1,""],MobileNetV2_x1_5:[7,3,1,""],MobileNetV2_x2_0:[7,3,1,""]},"paddleslim.models.mobilenet_v2.MobileNetV2":{conv_bn_layer:[7,2,1,""],inverted_residual_unit:[7,2,1,""],invresi_blocks:[7,2,1,""],net:[7,2,1,""],shortcut:[7,2,1,""]},"paddleslim.models.resnet":{ResNet101:[7,3,1,""],ResNet152:[7,3,1,""],ResNet34:[7,3,1,""],ResNet50:[7,3,1,""],ResNet:[7,1,1,""]},"paddleslim.models.resnet.ResNet":{basic_block:[7,2,1,""],bottleneck_block:[7,2,1,""],conv_bn_layer:[7,2,1,""],net:[7,2,1,""],shortcut:[7,2,1,""]},"paddleslim.models.util":{image_classification:[7,3,1,""]},"paddleslim.nas":{one_shot:[9,0,0,"-"],sa_nas:[8,0,0,"-"]},"paddleslim.nas.one_shot":{OneShotSearch:[9,3,1,""],OneShotSuperNet:[9,1,1,""],SuperMnasnet:[9,1,1,""],one_shot_nas:[9,0,0,"-"],super_mnasnet:[9,0,0,"-"]},"paddleslim.nas.one_shot.OneShotSuperNet":{forward:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.one_shot.SuperMnasnet":{get_flops:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.one_shot.one_shot_nas":{OneShotSearch:[9,3,1,""],OneShotSuperNet:[9,1,1,""]},"paddleslim.nas.one_shot.one_shot_nas.OneShotSuperNet":{forward:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.one_shot.super_mnasnet":{SuperMnasnet:[9,1,1,""]},"paddleslim.nas.one_shot.super_mnasnet.SuperMnasnet":{get_flops:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.sa_nas":{SANAS:[8,1,1,""]},"paddleslim.nas.sa_nas.SANAS":{current_info:[8,2,1,""],next_archs:[8,2,1,""],reward:[8,2,1,""],tokens2arch:[8,2,1,""]},"paddleslim.pantheon":{Student:[10,1,1,""],Teacher:[10,1,1,""],student:[10,0,0,"-"],teacher:[10,0,0,"-"],utils:[10,0,0,"-"]},"paddleslim.pantheon.Student":{get_knowledge_desc:[10,2,1,""],get_knowledge_generator:[10,2,1,""],get_knowledge_qsize:[10,2,1,""],recv:[10,2,1,""],register_teacher:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""]},"paddleslim.pantheon.Teacher":{dump:[10,2,1,""],recv:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""],start_knowledge_service:[10,2,1,""]},"paddleslim.pantheon.student":{Student:[10,1,1,""]},"paddleslim.pantheon.student.Student":{get_knowledge_desc:[10,2,1,""],get_knowledge_generator:[10,2,1,""],get_knowledge_qsize:[10,2,1,""],recv:[10,2,1,""],register_teacher:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""]},"paddleslim.pantheon.teacher":{Teacher:[10,1,1,""]},"paddleslim.pantheon.teacher.Teacher":{dump:[10,2,1,""],recv:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""],start_knowledge_service:[10,2,1,""]},"paddleslim.pantheon.utils":{EndSignal:[10,1,1,""],StartSignal:[10,1,1,""],SyncSignal:[10,1,1,""],check_ip:[10,3,1,""],convert_dtype:[10,3,1,""]},"paddleslim.prune":{AutoPruner:[11,1,1,""],Pruner:[11,1,1,""],SensitivePruner:[11,1,1,""],auto_pruner:[11,0,0,"-"],conv2d:[11,1,1,""],flops_sensitivity:[11,3,1,""],get_ratios_by_loss:[11,3,1,""],load_model:[11,3,1,""],load_sensitivities:[11,3,1,""],merge_sensitive:[11,3,1,""],prune_io:[11,0,0,"-"],prune_walker:[11,0,0,"-"],pruner:[11,0,0,"-"],save_model:[11,3,1,""],sensitive:[11,0,0,"-"],sensitive_pruner:[11,0,0,"-"],sensitivity:[11,3,1,""]},"paddleslim.prune.AutoPruner":{prune:[11,2,1,""],reward:[11,2,1,""]},"paddleslim.prune.Pruner":{prune:[11,2,1,""]},"paddleslim.prune.SensitivePruner":{get_ratios_by_sensitive:[11,2,1,""],greedy_prune:[11,2,1,""],prune:[11,2,1,""],restore:[11,2,1,""],save_checkpoint:[11,2,1,""]},"paddleslim.prune.auto_pruner":{AutoPruner:[11,1,1,""]},"paddleslim.prune.auto_pruner.AutoPruner":{prune:[11,2,1,""],reward:[11,2,1,""]},"paddleslim.prune.prune_io":{load_model:[11,3,1,""],save_model:[11,3,1,""]},"paddleslim.prune.prune_walker":{conv2d:[11,1,1,""]},"paddleslim.prune.pruner":{Pruner:[11,1,1,""]},"paddleslim.prune.pruner.Pruner":{prune:[11,2,1,""]},"paddleslim.prune.sensitive":{flops_sensitivity:[11,3,1,""],get_ratios_by_loss:[11,3,1,""],load_sensitivities:[11,3,1,""],merge_sensitive:[11,3,1,""],sensitivity:[11,3,1,""]},"paddleslim.prune.sensitive_pruner":{SensitivePruner:[11,1,1,""]},"paddleslim.prune.sensitive_pruner.SensitivePruner":{get_ratios_by_sensitive:[11,2,1,""],greedy_prune:[11,2,1,""],prune:[11,2,1,""],restore:[11,2,1,""],save_checkpoint:[11,2,1,""]},"paddleslim.quant":{quant_embedding:[12,0,0,"-"],quanter:[12,0,0,"-"]},"paddleslim.quant.quant_embedding":{quant_embedding:[12,3,1,""]},"paddleslim.quant.quanter":{convert:[12,3,1,""],quant_aware:[12,3,1,""],quant_post:[12,3,1,""]},paddleslim:{analysis:[3,0,0,"-"],common:[4,0,0,"-"],core:[5,0,0,"-"],dist:[6,0,0,"-"],models:[7,0,0,"-"],pantheon:[10,0,0,"-"],prune:[11,0,0,"-"],quant:[12,0,0,"-"],version:[2,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"],"4":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function","4":"py:attribute"},terms:{"769x769":19,"94mb":[16,18],"\u4e2d\u6587\u6587\u6863":16,"\u5728\u53e6\u4e00\u4e2a\u8fdb\u7a0b\u4e2d":26,"abstract":[3,4],"class":[3,4,5,7,8,9,10,11,13],"default":[3,4,6,8,9,10,11,12,20,24],"final":[9,12,22,24,25,26],"float":[3,4,5,6,8,11,14,22,24],"function":[4,5,6,8,9,11,12,13,14,20,23,24,25],"import":[4,13],"int":[3,4,5,8,9,10,11,12,14],"new":[4,5,13],"public":10,"return":[3,4,5,6,8,9,10,11,12,13,22,26],"static":[10,16,18],"super":9,"true":[3,7,8,10,11,12,20,22,23,24,25,26],"try":[4,11],"var":[5,6,24,25],"while":[8,9,11,26],And:[11,23],But:26,FPS:19,For:[4,8,13],NOT:13,One:[16,18,26],Ops:20,The:[3,4,5,6,8,9,10,11,12,14,19,20,22,23,24,25,26],Then:[24,25],There:25,Use:13,Used:14,__dict__:20,__init__:13,__name__:4,_bn:13,_conv0:13,_conv1:13,_conv2:13,_conv:13,_conv_bn_lay:13,_elementwise_add:13,_resnet_block:13,_sep_weight:26,_shortcut:13,_vd:19,aadvanc:16,abil:[16,18],about:[0,8,13],abs:13,abs_max:12,acc1:[20,22,23,24,25,26],acc5:[20,22,23,24,25,26],acc:19,acc_top1:[20,22,26],acc_top1_n:26,acc_top5:[20,22,26],acc_top5_n:26,accept:[9,11],accord:[4,5,8,11,13,22,24,26],accuraci:[11,16,18,20,22,24,25,26],accuracy_loss:11,act:[7,13],activ:[12,14,25],activation_bit:12,active_typ:14,adam:22,add:[3,6,12,13,24],added:[6,10],address:[4,8,10],advanc:[16,18],after:[4,5,22,25,26],again:11,agent:4,algo:12,algorithm:8,all:[3,4,5,6,8,10,11,12,14,20],all_input:5,all_output:5,all_paramet:[5,26],alreadi:10,also:[11,16,18,20,26],analysi:[0,1,2,22,23,26],analysis:11,analyz:26,android:[16,18],ani:[5,10],anneal:[4,8,11],anoth:26,apart:26,api:[12,16,18,20,22,23,24,25,26],append:[11,13,20,22,24,25,26],appli:[12,16,18,26],applic:[16,18],arch:22,architectur:[4,8,13,14,20,21],arg:8,argument:[9,10,11],armv7:19,armv8:19,arrai:[13,22,24,25,26],arxiv:13,asctim:4,assembl:[16,18],assign:10,attr:5,attribut:5,auto:19,auto_prun:[1,2],autom:[16,18],automat:[4,16,18],autoprun:11,auxiliari:[16,18],avail:[16,17,18],averag:14,avg_cost:[20,22],avoid:20,awar:[16,18,21],axi:[13,14,22],backup:11,backward:5,base:[3,4,5,8,9,10,11,13,16,18,19,22,23,26],baselin:[16,18,19],basic_block:7,basicconfig:4,batch:[10,12,14,16,18,20,22,23,24,25,26],batch_gener:10,batch_norm:13,batch_num:[12,25],batch_reward:22,batch_siz:[10,12,20,22,23,24,25,26],becaus:[24,25],befor:[4,6,12,26],below:[11,20,23,26],benckmark:[16,18],best:[4,8,9,11],best_token:4,better:8,between:[11,12],beyond:19,bia:14,bigger:8,bind:4,bit:12,blazefac:19,blob:13,block:[8,13],block_mask:[8,13],block_num:[8,13],bn5c_branch2b:20,bool:[3,5,8,10,11,12],bottleneck_block:7,bottleneck_params_list:13,box:19,bracket:12,buf_siz:[10,22],buffer:10,build_program:22,c_in:14,c_out:14,cach:4,cache_dir:12,cache_path:4,cached_id:4,cached_read:[1,2],calcul:[3,11,12,25],calibr:[12,25],call:[9,10,24,25,26],callback:[4,9,11],can:[5,8,10,11,12,13,14,16,18,20,24,26],cann:11,cannot:24,capac:10,carri:10,categori:20,caus:20,ceil:14,ceil_mod:14,cellphon:[16,18],certain:8,certainli:8,ch_out:7,chang:[23,24],change_depth:7,channel:[7,9,11,13,14,16,18,21],channel_in:13,channel_num:13,chapter:22,check:4,check_ip:10,checkpoint:[4,8,11],cifar10:[19,22],cifar:22,cityscap:19,class_dim:[7,20],class_num:7,classif:[21,27],classification_model:[1,2],classsif:[23,26],client:[4,11],client_nam:4,client_num:4,clip:12,clone:[5,17,22],close:[4,24,25],cls:5,coco:19,code:[13,20,23,26],collect:[13,16,18],com:[13,17],combin:6,comma:14,command:10,common:[1,2,10],commun:11,compiledprogram:12,compress:[16,18],comput:[9,11,14,16,18],condit:11,config:[4,8,10,12,13,19,22],configur:[8,24],conflict:20,connect:[4,11],consid:11,consist:[6,8],constrain:[16,18],constrain_func:4,constraint:[4,22],construct:[13,24,25],consult:[16,18],contain:[9,10,16,18,22,24,25],continu:22,control:[1,2,8,11],control_token:4,controller_cli:[1,2],controller_serv:[1,2],controllercli:4,controllerserv:4,conv1:7,conv1_nam:7,conv2_1_sep_weight:23,conv2_2_sep_weight:23,conv2d:[11,12,13],conv:13,conv_bn_lay:[7,13],conveni:[24,25],converg:8,convert:[8,12,24],convert_dtyp:10,convlut:3,convolut:[3,5,11,13,16,18,26],convolutoin:26,core:[1,2],correctli:[20,22,23,24,25,26],correspind:8,correspond:[8,10,14,20],cost:[16,18,19,20,22,26],count:[3,4,26],cpu:10,cpu_num:10,cpuplac:[6,11,12,20,22,23,24,25],creat:14,criterion:[11,19],cross_entropi:[20,22],cuda_visible_devic:10,cudaplac:[6,11,12,26],current:[3,4,5,8,9,11,13,22,26],current_flop:22,current_info:8,current_token:4,cut:11,cycl:22,dark:[16,18],dart:19,darts_sa:19,data:[4,8,10,12,16,18,20,23],data_feed:[22,26],data_map_map:6,data_name_map:[6,20],data_read:22,data_residu:7,datafeed:[20,22,23,24,25,26],dataload:[10,12],dataset:[4,11,19,20,22,24,25,26],dcn:19,decai:[4,11],decor:13,decoupl:[16,18],deep:[16,18],deeplabv3:19,def:[13,22,24,25,26],defalut:[11,12],default_main_program:22,defin:[3,4,5,6,9,10,13,16,18,24,25],delimit:3,demo:[20,23,26],denot:10,depend:[14,24,25],depthwise_conv2d:12,depthwise_conv2d_11:20,depthwise_separ:7,dequant:[12,24],describ:22,descript:10,detail:[3,8,14,19],determin:10,develop:[13,16,18],devic:[3,6,10,11,12,16,18,19],dict:[3,4,5,6,8,10,11,12],dictionari:[8,10],differ:[10,13,16,18],differenct:11,dilat:14,dimens:6,direct:12,directli:22,directori:[8,11,26],dirnam:[11,24,25],disabl:4,discret:8,disk:12,dist:[0,1,2,20],distil:6,distillationresnet34:[16,18],distribut:[16,18],divergenc:12,divid:6,document:16,doe:[24,25],doesn:10,doing:25,donnot:4,donot:14,down:[11,26],download:[19,20,22,23,24,25,26],drop:10,drop_last:[10,20,23,24,25,26],dtype:[10,12,20,22,24],dump:10,dure:[8,16,18,26],dygraph:9,dynam:[9,10,16,18],each:[3,9,10,11,16,18,22],easi:19,easier:[16,18],easili:23,either:[16,18],element:[5,11],elementwise_add:13,els:[4,13],empir:19,emsp:13,end:10,endsign:10,engin:[3,14],english:14,enough:26,ensur:[17,20,23,26],enumer:13,env:19,environ:[10,14],epoch:[20,22,23,24,25,26],equal:11,estim:[16,18],eva:26,eval_feed:22,eval_func:[9,11],eval_progarm:22,eval_program:[11,22],eval_read:[4,22],evalu:[3,4,11,14,26],everi:[9,12,13,14],evolut:[16,18],evolutionari:4,evolutionarycontrol:4,exampl:[4,13,24,25],except:6,exclud:14,excut:[20,23,26],exe:[10,11,20,22,23,24,25,26],execut:[9,10,11,26],executor:[10,11,12,20,22,24,25],exist:13,expansion_factor:7,experi:[8,22],explor:[8,16,18],extrem:8,face:19,factor:12,failur:8,fake:12,fals:[3,5,7,8,9,10,11,12,22,23,24],fast:19,faster:8,fc_name:7,featur:14,feed:[10,20,22,23,24,25,26],feed_list:10,feed_target_nam:25,feeded_var_nam:[24,25],fetch:10,fetch_list:[20,22,23,24,25,26],fetch_target:25,file:[3,4,5,10,11,12,13,14,16,18,19],filenam:12,filesystem:[11,26],filter:[5,11],filter_num:13,filter_s:[7,13],finally_reward:22,finetun:24,finish:10,first:[8,14,24,25],fit:20,flag_bia:14,flag_global_pool:14,flag_relu:14,flags_selected_gpu:10,flexibl:[16,18],float32:[20,22,24],float_prog:24,floor:14,flop:[1,2,11,13,16,18,22,26],flops_sensit:11,fluid:[3,5,6,9,10,11,12,13,20,22,23,24,25,26],fmt:4,follow:[10,13,14,20,22,23,24,25,26],for_test:[5,12,22,24],form:20,formal:[24,25],format:[3,4,8,9,10,11,13,20,22,23,24,26],forward:[9,25],fp32:[12,19],framework:[5,16,18,24,25],freez:12,freezed_program:12,freezed_program_int8:12,friendli:[16,18],from:[4,5,6,10,11,13,16,17,18,20,22,24,26],fsp:6,fsp_loss:6,fuction:26,func:10,furthermor:[16,18],gener:[4,8,9,10,11,12],get:[3,4,5,8,9,10,11,12,13,20,22,24,25],get_flop:9,get_knowledge_desc:10,get_knowledge_gener:10,get_knowledge_qs:10,get_logg:4,get_param_by_op:5,get_ratios_by_loss:[11,26],get_ratios_by_sensit:11,gflop:19,git:17,github:[13,17],given:[3,4,5,11,26],global:[6,14],global_block:[24,25,26],global_scop:[12,23,26],gpu:[10,19],granular:26,graph:[3,5,9,10,11],graph_wrapp:[1,2],graphwrapp:5,grapwrapp:3,greater:8,greedi:8,greedy_prun:11,group:[5,7,11,14,26],guard:20,h_in:14,handl:4,hard:19,hardwar:[0,16,18],has:[8,13,14],have:[17,20,22,23,24,25,26],head:13,height:14,higher:[8,13],histori:17,host:[8,11],how:[8,17,20,22,23,24,25,26],http:[13,17],human:5,hyperparamet:[4,16,18],ident:11,identifi:4,ids:10,idx:5,if_act:7,ifshortcut:7,ignor:10,imag:[21,27],image_classif:[7,13,23,24,25,26],image_shap:7,imagenet1000:19,imagenet2012:[16,18],implement:[16,18],in_address:10,in_c:7,in_nod:5,in_path:10,inception_v4:13,inceptionablock:13,inceptionablockspac:13,inceptioncblock:13,inceptioncblockspac:13,includ:[5,8,10,14,22],independ:[16,18],index:[13,14],indic:[5,6,9,19],infer:[3,10,12,14,16,18,24,25],infer_shap:5,inference_model:[24,25],inferfac:[24,25],info:4,inform:[4,8,11,14,26],inherit:13,init:[4,9,11],init_ratio:11,init_temperatur:[4,8,11],init_token:[4,8,9,13],initi:[4,8,13],input:[5,6,7,8,9,10,12,13,14,19,20,23,26],input_channel:9,input_data:22,input_s:[8,13],insert:12,instal:[16,20,22,23,24,25,26],instanc:[5,8,9,11],int64:[20,22],int8:[12,16,18,24],int8_prog:24,integ:9,interfac:6,introduct:19,inverted_residual_unit:7,invresi_block:7,iphon:[16,18],irgraph:5,is_bwd_op:5,is_first:7,is_full_quant:12,is_opt_op:5,is_paramet:5,is_persist:5,is_serv:[8,11],is_use_cache_fil:12,iter:[4,11,24,25],iterm:13,its:[10,14,26],jump:22,just:[3,23,26],keep:[16,18],kei:[3,4,5,6,8,10,11,12,20,26],kernel:[13,14],kirin:19,knowledg:10,kwarg:6,l140:13,l148:13,l173:13,l174:13,l1_norm:11,l291:13,l29:13,l2_loss:[6,20],l30:13,label:[6,20,22],languag:[12,16,18],lantenc:0,larg:[8,16,18],last:[4,10],latenc:[1,2,11,13,14,16,18,19],latency_855:19,latencyevalu:3,latest:[4,11,16,18],launch:10,layer:[3,5,7,9,13,16,18,20,22,26],layer_set:13,lazi:11,learn:[20,23,24,26],learning_r:22,least:9,legal:[4,11],len:13,length:[8,11,13],less:[8,10,11],level:[4,10],levelnam:4,librari:11,light:4,limit:10,line:[14,20],lis:9,list:[4,5,8,9,10,11,12,13],list_var:20,listen:4,lite:[19,24],load:[5,8,11,12,24,25],load_checkpoint:8,load_inference_model:25,load_model:11,load_sensit:[11,26],local:[4,16,18],lock:[1,2],lod:10,log:4,log_help:[1,2],logger:4,lookup_t:12,loss:[6,11,22,23,24,25,26],loss_func:6,loss_np:20,lower:8,mai:26,main:20,main_program:[24,25],make:[16,18,22,23,24,25,26],map:[6,12,14,16,18],mark:14,max:[4,11,14],max_client_num:[4,11],max_ratio:11,max_reward:4,max_try_tim:[4,11],max_valu:9,maximum:[4,9,10],mean:[4,8,9,10,11,13,20,22,24,25,26],meanwhil:[16,18],medium:19,meet:4,memori:12,merg:[6,10,11,16,18],merge_sensit:[11,26],merge_strategi:10,messag:4,method:[3,4,10,12,16,18,19,20,24,25],min:11,min_ratio:11,min_valu:9,mini:25,minim:[19,20,22],minimum:9,miou:19,mixup:19,mnist:[20,23,24,25,26],mobilenet:[1,2,19,20,23,24,25,26],mobilenet_v1:13,mobilenet_v2:[1,2,13],mobilenetv1:[16,18,19,20,23,24,25,26],mobilenetv1block:13,mobilenetv1blockspac:13,mobilenetv1spac:13,mobilenetv2:[7,13,16,18,19,22],mobilenetv2_na:19,mobilenetv2_scal:7,mobilenetv2_x1_0:7,mobilenetv2_x1_5:7,mobilenetv2_x2_0:7,mobilenetv2block:13,mobilenetv2blockspac:13,mobilenetv2spac:[13,22],mobilnetv1:13,mode:[3,9,10,16,18],model:[1,2,3,6,8,9,10,11,12,13,21,27],model_dir:[12,25],model_filenam:12,model_s:[1,2],models:19,modifi:11,modul:1,module_dict:5,momentum:20,monitor:10,more:[8,12,16,18,20,26],much:8,mul:[3,12],multi:14,multipl:[10,16,18],must:[11,12],n_in:14,naiv:[16,18],name:[3,4,5,6,7,8,9,10,11,12,13,14,20,22,23,24,25],name_prefix:[6,20],name_scop:9,namespac:13,nas:[0,1,2,4,22],nas_checkpoint:8,nasv2:19,necessari:[10,13,22,26],need:[8,13,20,22,24,25],nerual:21,net:[7,9,20],net_arch:13,network:[8,9,11,20],neural:[4,8,13,22],never:4,next:[4,5,8,22],next_arch:[8,22],next_op:5,next_token:4,node:[5,10,16,18],none:[4,5,6,7,8,9,10,11,12,13,14,20,22],normal:8,note:[8,19,23,24,25,26],now:10,num_filt:[7,13],num_filters1:7,num_filters2:7,num_group:7,num_in_filt:7,number:[3,4,5,8,10,11,12,13,14,20,23,26],numeb:13,numel_param:5,numpi:[13,22,24,25,26],obj365_pretrain:19,object:[3,4,5,8,10,11],observ:20,obtain:[8,12],offlin:[10,16,18],onc:10,one:[9,10,14,20,24,25,26],one_shot:[0,2,8],one_shot_na:[2,8],oneshotsearch:9,oneshotsupernet:9,onli:[3,8,10,11,12,13,24,25],onlin:[10,16,18],only_conv:3,only_graph:[11,26],op_typ:14,open:[16,18],oper:[3,5,12,20,24],ops:5,opt:20,optim:[5,14,20,22],option:[12,14,26],opwrapp:5,order:[10,20,22,24,25],org:[13,17],origin:13,other:[6,10,26],otherwis:[3,9,12],out:[10,20],out_channel:9,out_nod:5,out_path:10,out_port:10,output:[4,5,8,9,10,14,20,22,23,24,25,26],output_s:[8,13],overwrit:13,packag:[0,1,17,20,23,26],pad:[7,13,14],paddl:[4,5,6,9,11,16,18,20,22,23,24,25,26],paddle1:[20,23,24,25,26],paddlecv:13,paddlelit:19,paddlepaddl:[13,17],paddlepaddle1:17,paddleslim:[0,14,16,17,18,20,22,23,24,25,26],pair:10,pantheon:[0,1,2,16,18],paper:[13,16,18],param:[4,8,11,12,19,23,26],param_backup:11,param_nam:11,param_shape_backup:11,paramat:11,paramet:[3,4,5,6,8,9,10,11,12,14,23,24,25],params_filenam:12,params_nam:12,pars:10,partial:4,pasacl:19,pascal:19,path:[3,4,10,12],pdf:13,percent:11,percis:13,perform:[3,9,20,24,25,26],persist:5,pickl:11,pip:17,place:[6,11,12,22,23,24,26],platform:[16,18],pleas:[8,17,19,20,22,23,24,25,26],plu:10,pool_typ:14,pop:10,port:[4,8,10,11,16,18],posit:9,possibl:[8,14],post:[12,16,18,21],pre:[19,22,24,25],pre_op:5,precis:12,predict:[10,16,18,20],prefix:[6,20],prefix_nam:7,preform:[24,25],prelu:14,preserv:8,pretrain:26,previou:5,primit:[16,18],print:[20,22,23,24,25,26],probabl:8,process:[13,16,18,24,25],prog:[24,25],program:[3,5,6,10,11,12,16,18,24,25,26],program_guard:[20,22],provid:[12,16,18],prun:[16,18],prune:[0,1,2,5,21,27],prune_io:[1,2],prune_walk:[1,2],pruned_flop:11,pruned_flops_r:11,pruned_lat:11,pruned_param:11,pruned_program:[11,23,26],pruned_ratio:[11,26],pruned_val_program:26,pruner:[1,2,23,26],prunework:11,purpos:13,push:10,pypi:17,pyread:10,python:[10,12,13,17],qsize:10,qualcomm:19,quant:[0,1,2,24,25],quant_awar:[12,19,24],quant_embed:[1,2],quant_post:[12,19,25],quant_post_model:25,quant_post_prog:25,quant_program:24,quanter:[1,2],quantiz:[12,21],quantizable_op_typ:12,quantize_bit:12,quantize_model_path:[12,25],quantize_typ:12,queue:10,quick:16,quickli:26,r34:19,r50:19,random:[4,8],randomli:8,rang:[4,8,9,13,14,16,18,22,24],range_t:[4,9,13],rank:14,rate:[4,8,11,24],ratio:[11,23],reach:[10,24,25],read:[20,22,23,24,25,26],readabl:5,reader:[4,10,20,22,23,24,25],reader_config:10,real:10,reason:[24,25,26],receiv:10,reciev:10,record:[3,12],recv:10,reduc:8,reduce_r:[4,8,11],reduct:8,refer:[8,13,16,18,19],regist:[5,10,13],register_teach:10,registr:10,registri:[1,2],relu6:14,relu:[7,13,14],rememb:4,remov:26,repeat:[10,13],repeat_tim:9,repeatedli:26,repres:[6,9,12,13,14],request:4,request_current_info:4,res:[24,25],research:[16,18],reset:4,resnet101:[7,19],resnet152:7,resnet34:[7,16,18,19],resnet50:[7,16,18,19,20],resnet50_vd1:19,resnet50_vd:19,resnet:[1,2,13,16,18],resnet_lay:13,resnetblock:13,resnetblockspac:13,resnetblockspace2:13,resnetspac:13,respect:10,restor:11,result:[24,25,26],reward:[4,8,11,22],reward_avg:22,risk:19,rk3288:[16,18],rtype:8,run:[4,6,10,12,16,18,20,22,23,24,25,26],s_0:26,s_1:26,sa_control:[1,2],sa_na:[1,2],sacontrol:4,same:[4,10,12,13,16,18,20],sampl:[4,10,12,16,18],sample_gener:[10,12,25],sample_list_gener:10,sampled_r:4,sana:[4,8,13,19],satisfi:22,save:[4,8,11,12,14,25,26],save_checkpoint:[8,11,22],save_inference_model:[12,24,25],save_int8:[12,24],save_model:11,scalabl:[16,18],scalar:11,scale:[7,12,16,18,25],scene:4,schema:10,scnn:19,scope:[5,6,9,11,12],score:[8,11],search:[0,4,8,9,11,21],search_space_bas:13,search_space_registri:13,search_step:[4,8,9,11],searcher:4,searchspac:13,searchspacebas:13,second:6,section:[22,23,24,25,26],see:[10,20],segment:[16,18],select:[24,25],self:[6,13,16,18],semant:[16,18],send:10,sens_0:26,sens_1:26,sensit:[1,2,16,18,19,27],sensitive_prun:[1,2],sensitiveprun:11,sensitivities_0:26,sensitivities_1:26,sensitivities_fil:[11,26],sent:10,separ:12,serv:10,server:[4,8,11],server_addr:[8,11,22],server_ip:4,server_port:4,servic:10,set:[4,5,8,9,10,11,12,13,26],set_attr:5,set_shap:5,sett:4,setup:17,shape:[5,10,11,13,20,22,23,26],share:10,shortcut:7,shortcut_conv:13,shot:[9,16,18],should:[4,6,9,10,11,12,24,26],show:[22,24,25,26],shuffl:22,sigmoid:14,similar:12,simpl:[17,23,26],simplifi:[24,25],simul:[4,8,11],simultan:4,singl:[11,12],single_distil:[1,2],size:[3,8,10,12,13,14,16,18,19,22,24,25],slim:[4,5,20,22,23,24,25,26],slow:26,slower:8,small:[8,16,18,24,25,26],smaller:[8,13,24],snapdragon:19,socket:4,soft:6,soft_label_loss:6,softmax:[6,22],softmax_out:22,solut:[4,16,18],some:[3,5,11,16,18,26],some_batch_genr:10,some_sample_gener:10,some_sample_list_gener:10,sort:11,sourc:[4,17],space:[0,4,8,9],special:[5,14],specifi:[6,10,13,20],speed:[19,24,25,26],split:[14,26],stabl:8,stage:9,start:[4,8,10,16,26],start_ev:22,start_knowledge_servic:10,start_train:22,startsign:10,startup_program:22,state:8,statu:4,steadi:8,step3:22,step:[4,8,9,11,22],stop:4,store:[11,23],str:[3,4,5,6,8,9,10,11,12,14],strategi:[9,10,11,16,18],stride:[7,9,13,14],string:[2,8,14],strong:8,strore:11,structur:[24,25],student:[1,2,6,16,18,19,20],student_feature_map:6,student_model_var:20,student_program:6,student_startup:20,student_temperatur:6,student_var1:6,student_var1_nam:6,student_var2:6,student_var2_nam:6,student_var:[6,20],student_var_nam:6,sub:[8,9],submodul:1,subpackag:1,successfulli:8,suffix:19,suggest:8,suitabl:24,sum:10,super_mnasnet:[2,8],supermnasnet:9,support:[10,11,12,14,16,18,26],sure:22,survei:[16,18],sychron:10,synchron:10,syncsign:10,system:4,tab:14,tabl:[0,4,9],table_fil:3,tablelatencyevalu:3,tanh:14,target:[3,5,11],target_var:[24,25],task:[4,8,16,18,23,26],tcp:[16,18],teacher:[1,2,6,16,18,19,20],teacher_:6,teacher_bn5c_branch2b:20,teacher_feature_map:6,teacher_id:10,teacher_model:20,teacher_model_var:20,teacher_program:6,teacher_startup:20,teacher_temperatur:6,teacher_var1:6,teacher_var1_nam:6,teacher_var2:6,teacher_var2_nam:6,teacher_var:[6,20],teacher_var_nam:6,technolog:[16,18],temp:12,temp_post_train:12,temperatur:[4,6,8,11],tensor:[5,12],tensorrt:19,test10:22,test:[11,12,19,20,22,23],test_program:22,test_read:[24,25,26],text:14,than:[8,10,11,16,18],thei:[16,18,24,25],them:[4,10,16,18],thi:[5,6,8,10,11,12,14,20,22,23,24,25,26],thread1:19,thread2:19,thread4:19,thread:[10,19],three:10,threshold:[11,12],time:[4,10,12,14,16,18,19,20,26],timestamp:14,tlatenc:14,tmp_0:20,tmp_3:20,token2arch:13,token:[4,8,9,11,13,19],tokens2arch:8,toolkit:[16,18],top1:[16,18,24,25],top5:[24,25],top:19,topk:11,total:[3,4,9],train10:22,train:[9,11,12,16,18,19,21],train_feed:[20,22,23,24,25],train_program:[11,22,23,24,25,26],train_read:[20,22,23,24,25,26],transfer:[10,16,18],transform:13,trial:10,tupl:[3,8,9,11,12],tutori:[16,20,22,23,24,25,26],two:20,txt:19,type:[3,4,5,6,8,9,10,11,12,14],uncom:20,under:12,unifi:20,uniform:[6,11,16,18,19],uniqu:10,unique_nam:20,univers:[16,18],unlock:4,unrel:10,unstabl:8,until:10,updat:[4,5,8,11],update_groups_of_conv:5,update_param_shap:5,usabl:4,use:[4,5,8,12,14,20,22,23,24,25,26],use_auxhead:9,use_cudnn:[7,22],use_gpu:[7,23,24,25,26],used:[3,4,5,6,8,9,10,11,12,13,14,22,23,24,26],user:[5,6,12],uses:[12,19,22],using:[4,12,14,24,25,26],usual:12,util:[1,2,12],v100:19,val_program:[23,24,25,26],val_quant_program:24,valid:[5,10],valu:[3,5,6,8,9,10,11,20,23,26],varaibl:9,variabl:[5,6,9,10,11,12,20],varibal:5,variou:[16,18],varwrapp:5,verifi:20,version:[1,19],vgg:[16,18],via:[16,18],vision:[16,18],visit:11,voc:19,volum:19,w_in:14,wai:14,wait:10,want:[8,13,22],weight:[11,12],weight_0:11,weight_1:11,weight_bit:12,well:[12,24,25],what:22,when:[10,11,12,24,25,26],whenev:10,where:[6,11,20],whether:[3,4,5,8,10,11,12,14],which:[4,6,8,9,11,12,20,22,24,25],whose:[3,9,10,11],why:8,wider:19,width:14,wise:[16,18],without:[4,24,25],won:26,work:[16,18],workflow:[20,23,26],wors:8,would:11,wrapper:[4,5,10],writer:10,wrote:10,yet:10,yolov3:19,you:[8,13,17,20,22,23,24,25,26],your:[16,18],yourself:8,zero:11,zoo:16},titles:["API Documents","paddleslim","paddleslim package","paddleslim.analysis package","paddleslim.common package","paddleslim.core package","paddleslim.dist package","paddleslim.models package","paddleslim.nas package","paddleslim.nas.one_shot package","paddleslim.pantheon package","paddleslim.prune package","paddleslim.quant package","search space","Table about hardware lantency","\u4e2d\u6587\u6587\u6863","Index","Install","Introduction","Model Zoo","Knowledge Distillation for Image Classification","Quick Start","Nerual Architecture Search for Image Classification","Channel Pruning for Image Classification","Training-aware Quantization of image classification model - quick start","Post-training Quantization of image classification model - quick start","Pruning of image classification model - sensitivity","Aadvanced Tutorials"],titleterms:{"\u4e2d\u6587\u6587\u6863":15,"function":[22,26],"import":[20,22,23,24,25,26],NAS:[16,18,19],aadvanc:27,about:[14,22],activaiton:14,add:20,after:[23,24],analysi:3,api:0,architectur:[16,18,22,24,25],auto_prun:11,awar:24,batch_norm:14,bofor:23,build:[22,23,26],cached_read:4,channel:23,classif:[16,18,19,20,22,23,24,25,26],classification_model:7,coco:[16,18],common:4,comput:[23,26],control:4,controller_cli:4,controller_serv:4,conv2d:14,core:5,data:[22,24,25,26],dataset:[16,18,23],defin:[20,22,23,26],definit:[24,25],depend:[20,22,23,26],detect:[16,18,19],dist:6,distil:[16,18,19,20],document:0,each:26,eltwis:14,evalu:22,exampl:22,expand:26,featur:[16,18,20],fetch:22,file:26,fix:[16,18],flop:[3,23],format:14,full:22,funciton:22,gener:26,get:26,graph_wrapp:5,hardwar:14,how:13,imag:[16,18,19,20,22,23,24,25,26],index:16,initi:22,input:[22,24,25],instal:17,instanc:22,introduc:14,introduct:[16,18],knowledg:[16,18,20],lantenc:14,latenc:3,load:26,lock:4,log_help:4,loss:20,map:20,merg:[20,26],mobilenet:[7,16,18],mobilenet_v2:7,model:[7,16,18,19,20,22,23,24,25,26],model_s:3,modul:[2,3,4,5,6,7,8,9,10,11,12],multi:26,name:26,nas:[8,9,13],necessari:[24,25],nerual:22,network:26,neural:[16,18],normal:[24,25],object:[16,18,19],one_shot:9,one_shot_na:9,oper:14,overview:14,packag:[2,3,4,5,6,7,8,9,10,11,12],paddleslim:[1,2,3,4,5,6,7,8,9,10,11,12,13],pantheon:10,paramet:26,pascal:[16,18],perform:[16,18],point:[16,18],pool:14,post:25,process:26,program:[20,22],provid:13,prune:[11,16,18,19,23,26],prune_io:11,prune_walk:11,pruner:11,quant:12,quant_embed:12,quanter:12,quantiz:[16,18,19,24,25],quick:[21,24,25],ratio:26,reader:26,registri:5,resnet:7,retur:22,sa_control:4,sa_na:8,sana:22,save:24,score:22,search:[13,16,18,22],segment:19,select:20,sensit:[11,26],sensitive_prun:11,sensitivi:26,singl:26,single_distil:6,softmax:14,space:13,start:[21,22,24,25],student:10,student_program:20,submodul:[2,3,4,5,6,7,8,9,10,11,12],subpackag:[2,8],super_mnasnet:9,tabl:14,teacher:10,teacher_program:20,test:[24,25,26],train:[20,22,23,24,25,26],tutori:27,use:13,util:[7,10],version:[2,14],voc:[16,18],which:13,write:13,yolov3:[16,18],yourself:13,zoo:19}}) \ No newline at end of file +Search.setIndex({docnames:["api_en/index_en","api_en/modules","api_en/paddleslim","api_en/paddleslim.analysis","api_en/paddleslim.common","api_en/paddleslim.core","api_en/paddleslim.dist","api_en/paddleslim.models","api_en/paddleslim.nas","api_en/paddleslim.nas.one_shot","api_en/paddleslim.pantheon","api_en/paddleslim.prune","api_en/paddleslim.quant","api_en/search_space_en","api_en/table_latency_en","index","index_en","install_en","intro_en","model_zoo_en","quick_start/distillation_tutorial_en","quick_start/index_en","quick_start/nas_tutorial_en","quick_start/pruning_tutorial_en","quick_start/quant_aware_tutorial_en","quick_start/quant_post_tutorial_en","tutorials/image_classification_sensitivity_analysis_tutorial_en","tutorials/index_en"],envversion:50,filenames:["api_en/index_en.rst","api_en/modules.rst","api_en/paddleslim.rst","api_en/paddleslim.analysis.rst","api_en/paddleslim.common.rst","api_en/paddleslim.core.rst","api_en/paddleslim.dist.rst","api_en/paddleslim.models.rst","api_en/paddleslim.nas.rst","api_en/paddleslim.nas.one_shot.rst","api_en/paddleslim.pantheon.rst","api_en/paddleslim.prune.rst","api_en/paddleslim.quant.rst","api_en/search_space_en.md","api_en/table_latency_en.md","index.rst","index_en.rst","install_en.md","intro_en.md","model_zoo_en.md","quick_start/distillation_tutorial_en.md","quick_start/index_en.rst","quick_start/nas_tutorial_en.md","quick_start/pruning_tutorial_en.md","quick_start/quant_aware_tutorial_en.md","quick_start/quant_post_tutorial_en.md","tutorials/image_classification_sensitivity_analysis_tutorial_en.md","tutorials/index_en.rst"],objects:{"":{paddleslim:[2,0,0,"-"]},"paddleslim.analysis":{LatencyEvaluator:[3,1,1,""],TableLatencyEvaluator:[3,1,1,""],flops:[3,0,0,"-"],latency:[3,0,0,"-"],model_size:[3,0,0,"-"]},"paddleslim.analysis.LatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.TableLatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.flops":{flops:[3,3,1,""]},"paddleslim.analysis.latency":{LatencyEvaluator:[3,1,1,""],TableLatencyEvaluator:[3,1,1,""]},"paddleslim.analysis.latency.LatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.latency.TableLatencyEvaluator":{latency:[3,2,1,""]},"paddleslim.analysis.model_size":{model_size:[3,3,1,""]},"paddleslim.common":{ControllerClient:[4,1,1,""],ControllerServer:[4,1,1,""],EvolutionaryController:[4,1,1,""],SAController:[4,1,1,""],cached_reader:[4,0,0,"-"],controller:[4,0,0,"-"],controller_client:[4,0,0,"-"],controller_server:[4,0,0,"-"],get_logger:[4,3,1,""],lock:[4,0,0,"-"],log_helper:[4,0,0,"-"],sa_controller:[4,0,0,"-"],unlock:[4,3,1,""]},"paddleslim.common.ControllerClient":{next_tokens:[4,2,1,""],request_current_info:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.ControllerServer":{close:[4,2,1,""],ip:[4,2,1,""],port:[4,2,1,""],run:[4,2,1,""],start:[4,2,1,""]},"paddleslim.common.EvolutionaryController":{next_tokens:[4,2,1,""],reset:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.SAController":{best_tokens:[4,4,1,""],current_tokens:[4,4,1,""],max_reward:[4,4,1,""],next_tokens:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.cached_reader":{cached_reader:[4,3,1,""]},"paddleslim.common.controller":{EvolutionaryController:[4,1,1,""]},"paddleslim.common.controller.EvolutionaryController":{next_tokens:[4,2,1,""],reset:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.controller_client":{ControllerClient:[4,1,1,""]},"paddleslim.common.controller_client.ControllerClient":{next_tokens:[4,2,1,""],request_current_info:[4,2,1,""],update:[4,2,1,""]},"paddleslim.common.controller_server":{ControllerServer:[4,1,1,""]},"paddleslim.common.controller_server.ControllerServer":{close:[4,2,1,""],ip:[4,2,1,""],port:[4,2,1,""],run:[4,2,1,""],start:[4,2,1,""]},"paddleslim.common.lock":{lock:[4,3,1,""],unlock:[4,3,1,""]},"paddleslim.common.log_helper":{get_logger:[4,3,1,""]},"paddleslim.common.sa_controller":{SAController:[4,1,1,""]},"paddleslim.common.sa_controller.SAController":{best_tokens:[4,4,1,""],current_tokens:[4,4,1,""],max_reward:[4,4,1,""],next_tokens:[4,2,1,""],update:[4,2,1,""]},"paddleslim.core":{GraphWrapper:[5,1,1,""],OpWrapper:[5,1,1,""],Registry:[5,1,1,""],VarWrapper:[5,1,1,""],graph_wrapper:[5,0,0,"-"],registry:[5,0,0,"-"]},"paddleslim.core.GraphWrapper":{"var":[5,2,1,""],all_parameters:[5,2,1,""],clone:[5,2,1,""],get_param_by_op:[5,2,1,""],infer_shape:[5,2,1,""],is_parameter:[5,2,1,""],is_persistable:[5,2,1,""],next_ops:[5,2,1,""],numel_params:[5,2,1,""],ops:[5,2,1,""],pre_ops:[5,2,1,""],program:[5,2,1,""],update_groups_of_conv:[5,2,1,""],update_param_shape:[5,2,1,""],vars:[5,2,1,""]},"paddleslim.core.OpWrapper":{all_inputs:[5,2,1,""],all_outputs:[5,2,1,""],attr:[5,2,1,""],idx:[5,2,1,""],inputs:[5,2,1,""],is_bwd_op:[5,2,1,""],is_opt_op:[5,2,1,""],outputs:[5,2,1,""],set_attr:[5,2,1,""],type:[5,2,1,""]},"paddleslim.core.Registry":{get:[5,2,1,""],module_dict:[5,4,1,""],name:[5,4,1,""],register:[5,2,1,""]},"paddleslim.core.VarWrapper":{inputs:[5,2,1,""],is_parameter:[5,2,1,""],name:[5,2,1,""],outputs:[5,2,1,""],set_shape:[5,2,1,""],shape:[5,2,1,""]},"paddleslim.core.graph_wrapper":{GraphWrapper:[5,1,1,""],OpWrapper:[5,1,1,""],VarWrapper:[5,1,1,""]},"paddleslim.core.graph_wrapper.GraphWrapper":{"var":[5,2,1,""],all_parameters:[5,2,1,""],clone:[5,2,1,""],get_param_by_op:[5,2,1,""],infer_shape:[5,2,1,""],is_parameter:[5,2,1,""],is_persistable:[5,2,1,""],next_ops:[5,2,1,""],numel_params:[5,2,1,""],ops:[5,2,1,""],pre_ops:[5,2,1,""],program:[5,2,1,""],update_groups_of_conv:[5,2,1,""],update_param_shape:[5,2,1,""],vars:[5,2,1,""]},"paddleslim.core.graph_wrapper.OpWrapper":{all_inputs:[5,2,1,""],all_outputs:[5,2,1,""],attr:[5,2,1,""],idx:[5,2,1,""],inputs:[5,2,1,""],is_bwd_op:[5,2,1,""],is_opt_op:[5,2,1,""],outputs:[5,2,1,""],set_attr:[5,2,1,""],type:[5,2,1,""]},"paddleslim.core.graph_wrapper.VarWrapper":{inputs:[5,2,1,""],is_parameter:[5,2,1,""],name:[5,2,1,""],outputs:[5,2,1,""],set_shape:[5,2,1,""],shape:[5,2,1,""]},"paddleslim.core.registry":{Registry:[5,1,1,""]},"paddleslim.core.registry.Registry":{get:[5,2,1,""],module_dict:[5,4,1,""],name:[5,4,1,""],register:[5,2,1,""]},"paddleslim.dist":{single_distiller:[6,0,0,"-"]},"paddleslim.dist.single_distiller":{fsp_loss:[6,3,1,""],l2_loss:[6,3,1,""],loss:[6,3,1,""],merge:[6,3,1,""],soft_label_loss:[6,3,1,""]},"paddleslim.models":{classification_models:[7,0,0,"-"],image_classification:[7,3,1,""],mobilenet:[7,0,0,"-"],mobilenet_v2:[7,0,0,"-"],resnet:[7,0,0,"-"],util:[7,0,0,"-"]},"paddleslim.models.classification_models":{MobileNet:[7,1,1,""],MobileNetV2:[7,1,1,""],ResNet34:[7,3,1,""],ResNet50:[7,3,1,""]},"paddleslim.models.classification_models.MobileNet":{conv_bn_layer:[7,2,1,""],depthwise_separable:[7,2,1,""],net:[7,2,1,""]},"paddleslim.models.classification_models.MobileNetV2":{conv_bn_layer:[7,2,1,""],inverted_residual_unit:[7,2,1,""],invresi_blocks:[7,2,1,""],net:[7,2,1,""],shortcut:[7,2,1,""]},"paddleslim.models.mobilenet":{MobileNet:[7,1,1,""]},"paddleslim.models.mobilenet.MobileNet":{conv_bn_layer:[7,2,1,""],depthwise_separable:[7,2,1,""],net:[7,2,1,""]},"paddleslim.models.mobilenet_v2":{MobileNetV2:[7,1,1,""],MobileNetV2_scale:[7,3,1,""],MobileNetV2_x1_0:[7,3,1,""],MobileNetV2_x1_5:[7,3,1,""],MobileNetV2_x2_0:[7,3,1,""]},"paddleslim.models.mobilenet_v2.MobileNetV2":{conv_bn_layer:[7,2,1,""],inverted_residual_unit:[7,2,1,""],invresi_blocks:[7,2,1,""],net:[7,2,1,""],shortcut:[7,2,1,""]},"paddleslim.models.resnet":{ResNet101:[7,3,1,""],ResNet152:[7,3,1,""],ResNet34:[7,3,1,""],ResNet50:[7,3,1,""],ResNet:[7,1,1,""]},"paddleslim.models.resnet.ResNet":{basic_block:[7,2,1,""],bottleneck_block:[7,2,1,""],conv_bn_layer:[7,2,1,""],net:[7,2,1,""],shortcut:[7,2,1,""]},"paddleslim.models.util":{image_classification:[7,3,1,""]},"paddleslim.nas":{one_shot:[9,0,0,"-"],sa_nas:[8,0,0,"-"]},"paddleslim.nas.one_shot":{OneShotSearch:[9,3,1,""],OneShotSuperNet:[9,1,1,""],SuperMnasnet:[9,1,1,""],one_shot_nas:[9,0,0,"-"],super_mnasnet:[9,0,0,"-"]},"paddleslim.nas.one_shot.OneShotSuperNet":{forward:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.one_shot.SuperMnasnet":{get_flops:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.one_shot.one_shot_nas":{OneShotSearch:[9,3,1,""],OneShotSuperNet:[9,1,1,""]},"paddleslim.nas.one_shot.one_shot_nas.OneShotSuperNet":{forward:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.one_shot.super_mnasnet":{SuperMnasnet:[9,1,1,""]},"paddleslim.nas.one_shot.super_mnasnet.SuperMnasnet":{get_flops:[9,2,1,""],init_tokens:[9,2,1,""],range_table:[9,2,1,""]},"paddleslim.nas.sa_nas":{SANAS:[8,1,1,""]},"paddleslim.nas.sa_nas.SANAS":{current_info:[8,2,1,""],next_archs:[8,2,1,""],reward:[8,2,1,""],tokens2arch:[8,2,1,""]},"paddleslim.pantheon":{Student:[10,1,1,""],Teacher:[10,1,1,""],student:[10,0,0,"-"],teacher:[10,0,0,"-"],utils:[10,0,0,"-"]},"paddleslim.pantheon.Student":{get_knowledge_desc:[10,2,1,""],get_knowledge_generator:[10,2,1,""],get_knowledge_qsize:[10,2,1,""],recv:[10,2,1,""],register_teacher:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""]},"paddleslim.pantheon.Teacher":{dump:[10,2,1,""],recv:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""],start_knowledge_service:[10,2,1,""]},"paddleslim.pantheon.student":{Student:[10,1,1,""]},"paddleslim.pantheon.student.Student":{get_knowledge_desc:[10,2,1,""],get_knowledge_generator:[10,2,1,""],get_knowledge_qsize:[10,2,1,""],recv:[10,2,1,""],register_teacher:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""]},"paddleslim.pantheon.teacher":{Teacher:[10,1,1,""]},"paddleslim.pantheon.teacher.Teacher":{dump:[10,2,1,""],recv:[10,2,1,""],send:[10,2,1,""],start:[10,2,1,""],start_knowledge_service:[10,2,1,""]},"paddleslim.pantheon.utils":{EndSignal:[10,1,1,""],StartSignal:[10,1,1,""],SyncSignal:[10,1,1,""],check_ip:[10,3,1,""],convert_dtype:[10,3,1,""]},"paddleslim.prune":{AutoPruner:[11,1,1,""],Pruner:[11,1,1,""],SensitivePruner:[11,1,1,""],auto_pruner:[11,0,0,"-"],conv2d:[11,1,1,""],flops_sensitivity:[11,3,1,""],get_ratios_by_loss:[11,3,1,""],load_model:[11,3,1,""],load_sensitivities:[11,3,1,""],merge_sensitive:[11,3,1,""],prune_io:[11,0,0,"-"],prune_walker:[11,0,0,"-"],pruner:[11,0,0,"-"],save_model:[11,3,1,""],sensitive:[11,0,0,"-"],sensitive_pruner:[11,0,0,"-"],sensitivity:[11,3,1,""]},"paddleslim.prune.AutoPruner":{prune:[11,2,1,""],reward:[11,2,1,""]},"paddleslim.prune.Pruner":{prune:[11,2,1,""]},"paddleslim.prune.SensitivePruner":{get_ratios_by_sensitive:[11,2,1,""],greedy_prune:[11,2,1,""],prune:[11,2,1,""],restore:[11,2,1,""],save_checkpoint:[11,2,1,""]},"paddleslim.prune.auto_pruner":{AutoPruner:[11,1,1,""]},"paddleslim.prune.auto_pruner.AutoPruner":{prune:[11,2,1,""],reward:[11,2,1,""]},"paddleslim.prune.prune_io":{load_model:[11,3,1,""],save_model:[11,3,1,""]},"paddleslim.prune.prune_walker":{conv2d:[11,1,1,""]},"paddleslim.prune.pruner":{Pruner:[11,1,1,""]},"paddleslim.prune.pruner.Pruner":{prune:[11,2,1,""]},"paddleslim.prune.sensitive":{flops_sensitivity:[11,3,1,""],get_ratios_by_loss:[11,3,1,""],load_sensitivities:[11,3,1,""],merge_sensitive:[11,3,1,""],sensitivity:[11,3,1,""]},"paddleslim.prune.sensitive_pruner":{SensitivePruner:[11,1,1,""]},"paddleslim.prune.sensitive_pruner.SensitivePruner":{get_ratios_by_sensitive:[11,2,1,""],greedy_prune:[11,2,1,""],prune:[11,2,1,""],restore:[11,2,1,""],save_checkpoint:[11,2,1,""]},"paddleslim.quant":{quant_embedding:[12,0,0,"-"],quanter:[12,0,0,"-"]},"paddleslim.quant.quant_embedding":{quant_embedding:[12,3,1,""]},"paddleslim.quant.quanter":{convert:[12,3,1,""],quant_aware:[12,3,1,""],quant_post:[12,3,1,""]},paddleslim:{analysis:[3,0,0,"-"],common:[4,0,0,"-"],core:[5,0,0,"-"],dist:[6,0,0,"-"],models:[7,0,0,"-"],pantheon:[10,0,0,"-"],prune:[11,0,0,"-"],quant:[12,0,0,"-"],version:[2,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"],"4":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function","4":"py:attribute"},terms:{"769x769":19,"94mb":[16,18],"\u4e2d\u6587\u6587\u6863":16,"\u5728\u53e6\u4e00\u4e2a\u8fdb\u7a0b\u4e2d":26,"abstract":[3,4],"class":[3,4,5,7,8,9,10,11,13],"default":[3,4,6,8,9,10,11,12,20,24],"final":[9,12,22,24,25,26],"float":[3,4,5,6,8,11,14,22,24],"function":[4,5,6,8,9,11,12,13,14,20,23,24,25],"import":[4,13],"int":[3,4,5,8,9,10,11,12,14],"new":[4,5,13],"public":10,"return":[3,4,5,6,8,9,10,11,12,13,22,26],"static":[10,16,18],"super":9,"true":[3,7,8,10,11,12,20,22,23,24,25,26],"try":[4,11],"var":[5,6,24,25],"while":[8,9,11,26],And:[11,23],But:26,FPS:19,For:[4,8,13],NOT:13,One:[16,18,26],Ops:20,The:[3,4,5,6,8,9,10,11,12,14,19,20,22,23,24,25,26],Then:[24,25],There:25,Use:13,Used:14,__dict__:20,__init__:13,__name__:4,_bn:13,_conv0:13,_conv1:13,_conv2:13,_conv:13,_conv_bn_lay:13,_elementwise_add:13,_resnet_block:13,_sep_weight:26,_shortcut:13,_vd:19,aadvanc:16,abil:[16,18],about:[0,8,13],abs_max:12,acc1:[20,22,23,24,25,26],acc5:[20,22,23,24,25,26],acc:19,acc_top1:[20,22,26],acc_top1_n:26,acc_top5:[20,22,26],acc_top5_n:26,accept:[9,11],accord:[4,5,8,11,13,22,24,26],accuraci:[11,16,18,20,22,24,25,26],accuracy_loss:11,act:[7,13],activ:[12,14,25],activation_bit:12,active_typ:14,adam:22,add:[3,6,12,13,24],added:[6,10],address:[4,8,10],advanc:[16,18],after:[4,5,22,25,26],again:11,agent:4,algo:12,algorithm:8,all:[3,4,5,6,8,10,11,12,14,20],all_input:5,all_output:5,all_paramet:[5,26],alreadi:10,also:[11,16,18,20,26],analysi:[0,1,2,22,23,26],analysis:11,analyz:26,android:[16,18],ani:[5,10],anneal:[4,8,11],anoth:26,apart:26,api:[12,16,18,20,22,23,24,25,26],append:[11,13,20,22,24,25,26],appli:[12,16,18,26],applic:[16,18],arch:22,architectur:[4,8,14,20,21],arg:8,argument:[9,10,11],armv7:19,armv8:19,arrai:[13,22,24,25,26],asctim:4,assembl:[16,18],assign:10,attr:5,attribut:5,auto:19,auto_prun:[1,2],autom:[16,18],automat:[4,16,18],autoprun:11,auxiliari:[16,18],avail:[16,17,18],averag:14,avg_cost:[20,22],avoid:20,awar:[16,18,21],axi:[13,14,22],backup:11,backward:5,base:[3,4,5,8,9,10,11,16,18,19,22,23,26],baselin:[16,18,19],basic_block:7,basicconfig:4,batch:[10,12,14,16,18,20,22,23,24,25,26],batch_gener:10,batch_norm:13,batch_num:[12,25],batch_reward:22,batch_siz:[10,12,20,22,23,24,25,26],becaus:[24,25],befor:[4,6,12,26],below:[11,20,23,26],benckmark:[16,18],best:[4,8,9,11],best_token:4,better:8,between:[11,12],beyond:19,bia:14,bigger:8,bind:4,bit:12,blazefac:19,block:8,block_mask:[8,13],block_num:[8,13],bn5c_branch2b:20,bool:[3,5,8,10,11,12],bottleneck_block:7,bottleneck_params_list:13,box:19,bracket:12,buf_siz:[10,22],buffer:10,build_program:22,c_in:14,c_out:14,cach:4,cache_dir:12,cache_path:4,cached_id:4,cached_read:[1,2],calcul:[3,11,12,25],calibr:[12,25],call:[9,10,24,25,26],callback:[4,9,11],can:[5,8,10,11,12,13,14,16,18,20,24,26],cann:11,cannot:24,capac:10,carri:10,categori:20,caus:20,ceil:14,ceil_mod:14,cellphon:[16,18],certain:8,certainli:8,ch_out:7,chang:[23,24],change_depth:7,channel:[7,9,11,13,14,16,18,21],channel_in:13,channel_num:13,chapter:22,check:4,check_ip:10,checkpoint:[4,8,11],cifar10:[19,22],cifar:22,cityscap:19,class_dim:[7,20],class_num:7,classif:[21,27],classification_model:[1,2],classsif:[23,26],client:[4,11],client_nam:4,client_num:4,clip:12,clone:[5,17,22],close:[4,24,25],cls:5,coco:19,code:[13,20,23,26],collect:[13,16,18],com:17,combin:6,comma:14,command:10,common:[1,2,10],commun:11,compiledprogram:12,compress:[16,18],comput:[9,11,14,16,18],condit:11,config:[4,8,10,12,13,19,22],configur:[8,24],conflict:20,connect:[4,11],consid:11,consist:[6,8],constrain:[16,18],constrain_func:4,constraint:[4,22],construct:[13,24,25],consult:[16,18],contain:[9,10,16,18,22,24,25],continu:22,control:[1,2,8,11],control_token:4,controller_cli:[1,2],controller_serv:[1,2],controllercli:4,controllerserv:4,conv1:7,conv1_nam:7,conv2_1_sep_weight:23,conv2_2_sep_weight:23,conv2d:[11,12,13],conv:13,conv_bn_lay:[7,13],conveni:[24,25],converg:8,convert:[8,12,24],convert_dtyp:10,convlut:3,convolut:[3,5,11,13,16,18,26],convolutoin:26,core:[1,2],correctli:[20,22,23,24,25,26],correspind:8,correspond:[8,10,14,20],cost:[16,18,19,20,22,26],count:[3,4,26],cpu:10,cpu_num:10,cpuplac:[6,11,12,20,22,23,24,25],creat:14,criterion:[11,19],cross_entropi:[20,22],cuda_visible_devic:10,cudaplac:[6,11,12,26],current:[3,4,5,8,9,11,13,22,26],current_flop:22,current_info:8,current_token:4,cut:11,cycl:22,dark:[16,18],dart:19,darts_sa:19,data:[4,8,10,12,16,18,20,23],data_feed:[22,26],data_map_map:6,data_name_map:[6,20],data_read:22,data_residu:7,datafeed:[20,22,23,24,25,26],dataload:[10,12],dataset:[4,11,19,20,22,24,25,26],dcn:19,decai:[4,11],decor:13,decoupl:[16,18],deep:[16,18],deeplabv3:19,def:[13,22,24,25,26],defalut:[11,12],default_main_program:22,defin:[3,4,5,6,9,10,13,16,18,24,25],delimit:3,demo:[20,23,26],denot:10,depend:[14,24,25],depthwise_conv2d:12,depthwise_conv2d_11:20,depthwise_separ:7,dequant:[12,24],describ:22,descript:10,detail:[3,8,14,19],determin:10,develop:[16,18],devic:[3,6,10,11,12,16,18,19],dict:[3,4,5,6,8,10,11,12],dictionari:[8,10],differ:[10,16,18],differenct:11,dilat:14,dimens:6,direct:12,directli:22,directori:[8,11,26],dirnam:[11,24,25],disabl:4,discret:8,disk:12,dist:[0,1,2,20],distil:6,distillationresnet34:[16,18],distribut:[16,18],divergenc:12,divid:6,document:16,doe:[24,25],doesn:10,doing:25,donnot:4,donot:14,down:[11,26],download:[19,20,22,23,24,25,26],drop:10,drop_last:[10,20,23,24,25,26],dtype:[10,12,20,22,24],dump:10,dure:[8,16,18,26],dygraph:9,dynam:[9,10,16,18],each:[3,9,10,11,16,18,22],easi:19,easier:[16,18],easili:23,either:[16,18],element:[5,11],elementwise_add:13,els:[4,13],empir:19,emsp:13,end:10,endsign:10,engin:[3,14],english:14,enough:26,ensur:[17,20,23,26],enumer:13,env:19,environ:[10,14],epoch:[20,22,23,24,25,26],equal:11,estim:[16,18],eva:26,eval_feed:22,eval_func:[9,11],eval_progarm:22,eval_program:[11,22],eval_read:[4,22],evalu:[3,4,11,14,26],everi:[9,12,13,14],evolut:[16,18],evolutionari:4,evolutionarycontrol:4,exampl:[4,13,24,25],except:6,exclud:14,excut:[20,23,26],exe:[10,11,20,22,23,24,25,26],execut:[9,10,11,26],executor:[10,11,12,20,22,24,25],exist:13,expansion_factor:7,experi:[8,22],explor:[8,16,18],extrem:8,face:19,factor:12,failur:8,fake:12,fals:[3,5,7,8,9,10,11,12,22,23,24],fast:19,faster:8,fc_name:7,featur:14,feed:[10,20,22,23,24,25,26],feed_list:10,feed_target_nam:25,feeded_var_nam:[24,25],fetch:10,fetch_list:[20,22,23,24,25,26],fetch_target:25,file:[3,4,5,10,11,12,13,14,16,18,19],filenam:12,filesystem:[11,26],filter:[5,11],filter_num:13,filter_s:[7,13],finally_reward:22,finetun:24,finish:10,first:[8,14,24,25],fit:20,flag_bia:14,flag_global_pool:14,flag_relu:14,flags_selected_gpu:10,flexibl:[16,18],float32:[20,22,24],float_prog:24,floor:14,flop:[1,2,11,13,16,18,22,26],flops_sensit:11,fluid:[3,5,6,9,10,11,12,13,20,22,23,24,25,26],fmt:4,follow:[10,13,14,20,22,23,24,25,26],for_test:[5,12,22,24],form:20,formal:[24,25],format:[3,4,8,9,10,11,13,20,22,23,24,26],forward:[9,25],fp32:[12,19],framework:[5,16,18,24,25],freez:12,freezed_program:12,freezed_program_int8:12,friendli:[16,18],from:[4,5,6,10,11,16,17,18,20,22,24,26],fsp:6,fsp_loss:6,fuction:26,func:10,furthermor:[16,18],gener:[4,8,9,10,11,12],get:[3,4,5,8,9,10,11,12,13,20,22,24,25],get_flop:9,get_knowledge_desc:10,get_knowledge_gener:10,get_knowledge_qs:10,get_logg:4,get_param_by_op:5,get_ratios_by_loss:[11,26],get_ratios_by_sensit:11,gflop:19,git:17,github:17,given:[3,4,5,11,26],global:[6,14],global_block:[24,25,26],global_scop:[12,23,26],gpu:[10,19],granular:26,graph:[3,5,9,10,11],graph_wrapp:[1,2],graphwrapp:5,grapwrapp:3,greater:8,greedi:8,greedy_prun:11,group:[5,7,11,14,26],guard:20,h_in:14,handl:4,hard:19,hardwar:[0,16,18],has:[8,13,14],have:[17,20,22,23,24,25,26],head:13,height:14,higher:[8,13],histori:17,host:[8,11],how:[8,17,20,22,23,24,25,26],http:17,human:5,hyperparamet:[4,16,18],ident:11,identifi:4,ids:10,idx:5,if_act:7,ifshortcut:7,ignor:10,imag:[21,27],image_classif:[7,23,24,25,26],image_shap:7,imagenet1000:19,imagenet2012:[16,18],implement:[16,18],in_address:10,in_c:7,in_nod:5,in_path:10,inceptionablock:13,inceptionablockspac:13,inceptioncblock:13,inceptioncblockspac:13,includ:[5,8,10,14,22],independ:[16,18],index:[13,14],indic:[5,6,9,19],infer:[3,10,12,14,16,18,24,25],infer_shap:5,inference_model:[24,25],inferfac:[24,25],info:4,inform:[4,8,11,14,26],inherit:13,init:[4,9,11],init_ratio:11,init_temperatur:[4,8,11],init_token:[4,8,9,13],initi:[4,8,13],input:[5,6,7,8,9,10,12,13,14,19,20,23,26],input_channel:9,input_data:22,input_s:[8,13],insert:12,instal:[16,20,22,23,24,25,26],instanc:[5,8,9,11],int64:[20,22],int8:[12,16,18,24],int8_prog:24,integ:9,interfac:6,introduct:19,inverted_residual_unit:7,invresi_block:7,iphon:[16,18],irgraph:5,is_bwd_op:5,is_first:7,is_full_quant:12,is_opt_op:5,is_paramet:5,is_persist:5,is_serv:[8,11],is_use_cache_fil:12,iter:[4,11,24,25],iterm:13,its:[10,14,26],jump:22,just:[3,23,26],keep:[16,18],kei:[3,4,5,6,8,10,11,12,20,26],kernel:[13,14],kirin:19,knowledg:10,kwarg:6,l1_norm:11,l2_loss:[6,20],label:[6,20,22],languag:[12,16,18],lantenc:0,larg:[8,16,18],last:[4,10],latenc:[1,2,11,13,14,16,18,19],latency_855:19,latencyevalu:3,latest:[4,11,16,18],launch:10,layer:[3,5,7,9,13,16,18,20,22,26],layer_set:13,lazi:11,learn:[20,23,24,26],learning_r:22,least:9,legal:[4,11],len:13,length:[8,11,13],less:[8,10,11],level:[4,10],levelnam:4,librari:11,light:4,limit:10,line:[14,20],lis:9,list:[4,5,8,9,10,11,12,13],list_var:20,listen:4,lite:[19,24],load:[5,8,11,12,24,25],load_checkpoint:8,load_inference_model:25,load_model:11,load_sensit:[11,26],local:[4,16,18],lock:[1,2],lod:10,log:4,log_help:[1,2],logger:4,lookup_t:12,loss:[6,11,22,23,24,25,26],loss_func:6,loss_np:20,lower:8,mai:26,main:20,main_program:[24,25],make:[16,18,22,23,24,25,26],map:[6,12,14,16,18],mark:14,max:[4,11,14],max_client_num:[4,11],max_ratio:11,max_reward:4,max_try_tim:[4,11],max_valu:9,maximum:[4,9,10],mean:[4,8,9,10,11,13,20,22,24,25,26],meanwhil:[16,18],medium:19,meet:4,memori:12,merg:[6,10,11,16,18],merge_sensit:[11,26],merge_strategi:10,messag:4,method:[3,4,10,12,16,18,19,20,24,25],min:11,min_ratio:11,min_valu:9,mini:25,minim:[19,20,22],minimum:9,miou:19,mixup:19,mnist:[20,23,24,25,26],mobilenet:[1,2,19,20,23,24,25,26],mobilenet_v2:[1,2],mobilenetv1:[16,18,19,20,23,24,25,26],mobilenetv1block:13,mobilenetv1blockspac:13,mobilenetv1spac:13,mobilenetv2:[7,13,16,18,19,22],mobilenetv2_na:19,mobilenetv2_scal:7,mobilenetv2_x1_0:7,mobilenetv2_x1_5:7,mobilenetv2_x2_0:7,mobilenetv2block:13,mobilenetv2blockspac:13,mobilenetv2spac:[13,22],mobilnetv1:13,mode:[3,9,10,16,18],model:[1,2,3,6,8,9,10,11,12,21,27],model_dir:[12,25],model_filenam:12,model_s:[1,2],models:19,modifi:11,modul:1,module_dict:5,momentum:20,monitor:10,more:[8,12,16,18,20,26],much:8,mul:[3,12],multi:14,multipl:[10,16,18],must:[11,12],n_in:14,naiv:[16,18],name:[3,4,5,6,7,8,9,10,11,12,13,14,20,22,23,24,25],name_prefix:[6,20],name_scop:9,namespac:13,nas:[0,1,2,4,22],nas_checkpoint:8,nasv2:19,necessari:[10,13,22,26],need:[8,13,20,22,24,25],nerual:21,net:[7,9,20],net_arch:13,network:[8,9,11,20],neural:[4,8,13,22],never:4,next:[4,5,8,22],next_arch:[8,22],next_op:5,next_token:4,node:[5,10,16,18],none:[4,5,6,7,8,9,10,11,12,13,14,20,22],normal:8,note:[8,19,23,24,25,26],now:10,num_filt:[7,13],num_filters1:7,num_filters2:7,num_group:7,num_in_filt:7,number:[3,4,5,8,10,11,12,13,14,20,23,26],numeb:13,numel_param:5,numpi:[13,22,24,25,26],obj365_pretrain:19,object:[3,4,5,8,10,11],observ:20,obtain:[8,12],offlin:[10,16,18],onc:10,one:[9,10,14,20,24,25,26],one_shot:[0,2,8],one_shot_na:[2,8],oneshotsearch:9,oneshotsupernet:9,onli:[3,8,10,11,12,13,24,25],onlin:[10,16,18],only_conv:3,only_graph:[11,26],op_typ:14,open:[16,18],oper:[3,5,12,20,24],ops:5,opt:20,optim:[5,14,20,22],option:[12,14,26],opwrapp:5,order:[10,20,22,24,25],org:17,other:[6,10,26],otherwis:[3,9,12],out:[10,20],out_channel:9,out_nod:5,out_path:10,out_port:10,output:[4,5,8,9,10,14,20,22,23,24,25,26],output_s:[8,13],overwrit:13,packag:[0,1,17,20,23,26],pad:[7,13,14],paddl:[4,5,6,9,11,16,18,20,22,23,24,25,26],paddle1:[20,23,24,25,26],paddlelit:19,paddlepaddl:17,paddlepaddle1:17,paddleslim:[0,14,16,17,18,20,22,23,24,25,26],pair:10,pantheon:[0,1,2,16,18],paper:[13,16,18],param:[4,8,11,12,19,23,26],param_backup:11,param_nam:11,param_shape_backup:11,paramat:11,paramet:[3,4,5,6,8,9,10,11,12,14,23,24,25],params_filenam:12,params_nam:12,pars:10,partial:4,pasacl:19,pascal:19,path:[3,4,10,12],percent:11,percis:13,perform:[3,9,20,24,25,26],persist:5,pickl:11,pip:17,place:[6,11,12,22,23,24,26],platform:[16,18],pleas:[8,17,19,20,22,23,24,25,26],plu:10,pool_typ:14,pop:10,port:[4,8,10,11,16,18],posit:9,possibl:[8,14],post:[12,16,18,21],pre:[19,22,24,25],pre_op:5,precis:12,predict:[10,16,18,20],prefix:[6,20],prefix_nam:7,preform:[24,25],prelu:14,preserv:8,pretrain:26,previou:5,primit:[16,18],print:[20,22,23,24,25,26],probabl:8,process:[13,16,18,24,25],prog:[24,25],program:[3,5,6,10,11,12,16,18,24,25,26],program_guard:[20,22],provid:[12,16,18],prun:[16,18],prune:[0,1,2,5,21,27],prune_io:[1,2],prune_walk:[1,2],pruned_flop:11,pruned_flops_r:11,pruned_lat:11,pruned_param:11,pruned_program:[11,23,26],pruned_ratio:[11,26],pruned_val_program:26,pruner:[1,2,23,26],prunework:11,purpos:13,push:10,pypi:17,pyread:10,python:[10,12,17],qsize:10,qualcomm:19,quant:[0,1,2,24,25],quant_awar:[12,19,24],quant_embed:[1,2],quant_post:[12,19,25],quant_post_model:25,quant_post_prog:25,quant_program:24,quanter:[1,2],quantiz:[12,21],quantizable_op_typ:12,quantize_bit:12,quantize_model_path:[12,25],quantize_typ:12,queue:10,quick:16,quickli:26,r34:19,r50:19,random:[4,8],randomli:8,rang:[4,8,9,13,14,16,18,22,24],range_t:[4,9,13],rank:14,rate:[4,8,11,24],ratio:[11,23],reach:[10,24,25],read:[20,22,23,24,25,26],readabl:5,reader:[4,10,20,22,23,24,25],reader_config:10,real:10,reason:[24,25,26],receiv:10,reciev:10,record:[3,12],recv:10,reduc:8,reduce_r:[4,8,11],reduct:8,refer:[8,13,16,18,19],regist:[5,10,13],register_teach:10,registr:10,registri:[1,2],relu6:14,relu:[7,13,14],rememb:4,remov:26,repeat:[10,13],repeat_tim:9,repeatedli:26,repres:[6,9,12,13,14],request:4,request_current_info:4,res:[24,25],research:[16,18],reset:4,resnet101:[7,19],resnet152:7,resnet34:[7,16,18,19],resnet50:[7,16,18,19,20],resnet50_vd1:19,resnet50_vd:19,resnet:[1,2,13,16,18],resnet_lay:13,resnetblock:13,resnetblockspac:13,resnetblockspace2:13,resnetspac:13,respect:10,restor:11,result:[24,25,26],reward:[4,8,11,22],reward_avg:22,risk:19,rk3288:[16,18],rtype:8,run:[4,6,10,12,16,18,20,22,23,24,25,26],s_0:26,s_1:26,sa_control:[1,2],sa_na:[1,2],sacontrol:4,same:[4,10,12,13,16,18,20],sampl:[4,10,12,16,18],sample_gener:[10,12,25],sample_list_gener:10,sampled_r:4,sana:[4,8,13,19],satisfi:22,save:[4,8,11,12,14,25,26],save_checkpoint:[8,11,22],save_inference_model:[12,24,25],save_int8:[12,24],save_model:11,scalabl:[16,18],scalar:11,scale:[7,12,16,18,25],scene:4,schema:10,scnn:19,scope:[5,6,9,11,12],score:[8,11],search:[0,4,8,9,11,21],search_space_bas:13,search_space_registri:13,search_step:[4,8,9,11],searcher:4,searchspac:13,searchspacebas:13,second:6,section:[22,23,24,25,26],see:[10,20],segment:[16,18],select:[24,25],self:[6,13,16,18],semant:[16,18],send:10,sens_0:26,sens_1:26,sensit:[1,2,16,18,19,27],sensitive_prun:[1,2],sensitiveprun:11,sensitivities_0:26,sensitivities_1:26,sensitivities_fil:[11,26],sent:10,separ:12,serv:10,server:[4,8,11],server_addr:[8,11,22],server_ip:4,server_port:4,servic:10,set:[4,5,8,9,10,11,12,13,26],set_attr:5,set_shap:5,sett:4,setup:17,shape:[5,10,11,13,20,22,23,26],share:10,shortcut:7,shortcut_conv:13,shot:[9,16,18],should:[4,6,9,10,11,12,24,26],show:[22,24,25,26],shuffl:22,sigmoid:14,similar:12,simpl:[17,23,26],simplifi:[24,25],simul:[4,8,11],simultan:4,singl:[11,12],single_distil:[1,2],size:[3,8,10,12,13,14,16,18,19,22,24,25],slim:[4,5,20,22,23,24,25,26],slow:26,slower:8,small:[8,16,18,24,25,26],smaller:[8,13,24],snapdragon:19,socket:4,soft:6,soft_label_loss:6,softmax:[6,22],softmax_out:22,solut:[4,16,18],some:[3,5,11,16,18,26],some_batch_genr:10,some_sample_gener:10,some_sample_list_gener:10,sort:11,sourc:[4,17],space:[0,4,8,9],special:[5,14],specifi:[6,10,13,20],speed:[19,24,25,26],split:[14,26],stabl:8,stage:9,start:[4,8,10,16,26],start_ev:22,start_knowledge_servic:10,start_train:22,startsign:10,startup_program:22,state:8,statu:4,steadi:8,step3:22,step:[4,8,9,11,22],stop:4,store:[11,23],str:[3,4,5,6,8,9,10,11,12,14],strategi:[9,10,11,16,18],stride:[7,9,13,14],string:[2,8,14],strong:8,strore:11,structur:[24,25],student:[1,2,6,16,18,19,20],student_feature_map:6,student_model_var:20,student_program:6,student_startup:20,student_temperatur:6,student_var1:6,student_var1_nam:6,student_var2:6,student_var2_nam:6,student_var:[6,20],student_var_nam:6,sub:[8,9],submodul:1,subpackag:1,successfulli:8,suffix:19,suggest:8,suitabl:24,sum:10,super_mnasnet:[2,8],supermnasnet:9,support:[10,11,12,14,16,18,26],sure:22,survei:[16,18],sychron:10,synchron:10,syncsign:10,system:4,tab:14,tabl:[0,4,9],table_fil:3,tablelatencyevalu:3,tanh:14,target:[3,5,11],target_var:[24,25],task:[4,8,16,18,23,26],tcp:[16,18],teacher:[1,2,6,16,18,19,20],teacher_:6,teacher_bn5c_branch2b:20,teacher_feature_map:6,teacher_id:10,teacher_model:20,teacher_model_var:20,teacher_program:6,teacher_startup:20,teacher_temperatur:6,teacher_var1:6,teacher_var1_nam:6,teacher_var2:6,teacher_var2_nam:6,teacher_var:[6,20],teacher_var_nam:6,technolog:[16,18],temp:12,temp_post_train:12,temperatur:[4,6,8,11],tensor:[5,12],tensorrt:19,test10:22,test:[11,12,19,20,22,23],test_program:22,test_read:[24,25,26],text:14,than:[8,10,11,16,18],thei:[16,18,24,25],them:[4,10,16,18],thi:[5,6,8,10,11,12,14,20,22,23,24,25,26],thread1:19,thread2:19,thread4:19,thread:[10,19],three:10,threshold:[11,12],time:[4,10,12,14,16,18,19,20,26],timestamp:14,tlatenc:14,tmp_0:20,tmp_3:20,token2arch:13,token:[4,8,9,11,13,19],tokens2arch:8,toolkit:[16,18],top1:[16,18,24,25],top5:[24,25],top:19,topk:11,total:[3,4,9],train10:22,train:[9,11,12,16,18,19,21],train_feed:[20,22,23,24,25],train_program:[11,22,23,24,25,26],train_read:[20,22,23,24,25,26],transfer:[10,16,18],transform:13,trial:10,tupl:[3,8,9,11,12],tutori:[16,20,22,23,24,25,26],two:20,txt:19,type:[3,4,5,6,8,9,10,11,12,14],uncom:20,under:12,unifi:20,uniform:[6,11,16,18,19],uniqu:10,unique_nam:20,univers:[16,18],unlock:4,unrel:10,unstabl:8,until:10,updat:[4,5,8,11],update_groups_of_conv:5,update_param_shap:5,usabl:4,use:[4,5,8,12,14,20,22,23,24,25,26],use_auxhead:9,use_cudnn:[7,22],use_gpu:[7,23,24,25,26],used:[3,4,5,6,8,9,10,11,12,13,14,22,23,24,26],user:[5,6,12],uses:[12,19,22],using:[4,12,14,24,25,26],usual:12,util:[1,2,12],v100:19,val_program:[23,24,25,26],val_quant_program:24,valid:[5,10],valu:[3,5,6,8,9,10,11,20,23,26],varaibl:9,variabl:[5,6,9,10,11,12,20],varibal:5,variou:[16,18],varwrapp:5,verifi:20,version:[1,19],vgg:[16,18],via:[16,18],vision:[16,18],visit:11,voc:19,volum:19,w_in:14,wai:14,wait:10,want:[8,13,22],weight:[11,12],weight_0:11,weight_1:11,weight_bit:12,well:[12,24,25],what:22,when:[10,11,12,24,25,26],whenev:10,where:[6,11,20],whether:[3,4,5,8,10,11,12,14],which:[4,6,8,9,11,12,20,22,24,25],whose:[3,9,10,11],why:8,wider:19,width:14,wise:[16,18],without:[4,24,25],won:26,work:[16,18],workflow:[20,23,26],wors:8,would:11,wrapper:[4,5,10],writer:10,wrote:10,yet:10,yolov3:19,you:[8,13,17,20,22,23,24,25,26],your:[16,18],yourself:8,zero:11,zoo:16},titles:["API Documents","paddleslim","paddleslim package","paddleslim.analysis package","paddleslim.common package","paddleslim.core package","paddleslim.dist package","paddleslim.models package","paddleslim.nas package","paddleslim.nas.one_shot package","paddleslim.pantheon package","paddleslim.prune package","paddleslim.quant package","search space","Table about hardware lantency","\u4e2d\u6587\u6587\u6863","Index","Install","Introduction","Model Zoo","Knowledge Distillation for Image Classification","Quick Start","Nerual Architecture Search for Image Classification","Channel Pruning for Image Classification","Training-aware Quantization of image classification model - quick start","Post-training Quantization of image classification model - quick start","Pruning of image classification model - sensitivity","Aadvanced Tutorials"],titleterms:{"\u4e2d\u6587\u6587\u6863":15,"function":[22,26],"import":[20,22,23,24,25,26],NAS:[16,18,19],aadvanc:27,about:[14,22],activaiton:14,add:20,after:[23,24],analysi:3,api:0,architectur:[13,16,18,22,24,25],auto_prun:11,awar:24,base:13,batch_norm:14,block:13,bofor:23,build:[22,23,26],cached_read:4,channel:23,classif:[16,18,19,20,22,23,24,25,26],classification_model:7,coco:[16,18],common:4,comput:[23,26],control:4,controller_cli:4,controller_serv:4,conv2d:14,core:5,data:[22,24,25,26],dataset:[16,18,23],defin:[20,22,23,26],definit:[24,25],depend:[20,22,23,26],detect:[16,18,19],differ:13,dist:6,distil:[16,18,19,20],document:0,each:26,eltwis:14,evalu:22,exampl:22,expand:26,featur:[16,18,20],fetch:22,file:26,fix:[16,18],flop:[3,23],format:14,from:13,full:22,funciton:22,gener:26,get:26,graph_wrapp:5,hardwar:14,how:13,imag:[16,18,19,20,22,23,24,25,26],index:16,initi:22,input:[22,24,25],instal:17,instanc:22,introduc:14,introduct:[16,18],knowledg:[16,18,20],lantenc:14,latenc:3,load:26,lock:4,log_help:4,loss:20,map:20,merg:[20,26],mobilenet:[7,16,18],mobilenet_v2:7,model:[7,13,16,18,19,20,22,23,24,25,26],model_s:3,modul:[2,3,4,5,6,7,8,9,10,11,12],multi:26,name:26,nas:[8,9,13],necessari:[24,25],nerual:22,network:26,neural:[16,18],normal:[24,25],object:[16,18,19],one_shot:9,one_shot_na:9,oper:14,origin:13,overview:14,packag:[2,3,4,5,6,7,8,9,10,11,12],paddleslim:[1,2,3,4,5,6,7,8,9,10,11,12,13],pantheon:10,paramet:26,pascal:[16,18],perform:[16,18],point:[16,18],pool:14,post:25,process:26,program:[20,22],provid:13,prune:[11,16,18,19,23,26],prune_io:11,prune_walk:11,pruner:11,quant:12,quant_embed:12,quanter:12,quantiz:[16,18,19,24,25],quick:[21,24,25],ratio:26,reader:26,registri:5,resnet:7,retur:22,sa_control:4,sa_na:8,sana:22,save:24,score:22,search:[13,16,18,22],segment:19,select:20,sensit:[11,26],sensitive_prun:11,sensitivi:26,singl:26,single_distil:6,softmax:14,space:13,start:[21,22,24,25],student:10,student_program:20,submodul:[2,3,4,5,6,7,8,9,10,11,12],subpackag:[2,8],super_mnasnet:9,tabl:14,teacher:10,teacher_program:20,test:[24,25,26],train:[20,22,23,24,25,26],tutori:27,use:13,util:[7,10],version:[2,14],voc:[16,18],which:13,write:13,yolov3:[16,18],yourself:13,zoo:19}}) \ No newline at end of file -- GitLab