-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docathon] Add NO.64-67 API CN Doc (#6224)
* add reset_excluded_layers * add set_excluded_layers * add others * rename * Update docs/api/paddle/incubate/asp/reset_excluded_layers_cn.rst Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * Update docs/api/paddle/incubate/asp/set_excluded_layers_cn.rst Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * Update docs/api/paddle/incubate/asp/reset_excluded_layers_cn.rst Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * fix --------- Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
- Loading branch information
1 parent
0adf9cc
commit 060eaf4
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.. _cn_api_paddle_incubate_asp_add_supported_layer: | ||
|
||
add_supported_layer | ||
------------------------------- | ||
|
||
.. py:function:: paddle.incubate.asp.add_supported_layer(layer, pruning_func=None) | ||
添加支持的 layer 及其相应的剪枝函数。 | ||
|
||
参数 | ||
::::::::: | ||
- **name** (string|Layer) - 需要支持的 layer 的名称或类型。 如果 layer 是 Layer,那么它将在内部转为字符串。ASP 将使用这个名称来匹配参数的名称并调用其相应的剪枝函数。 | ||
- **pruning_func** (function,可选) - 一个接收五个参数(weight_nparray、m、n、func_name、param_name)的函数类型,weight_nparray 是 nparray 格式的权重,param_name 是权重的名称,m、n 和 func_name,详细信息请参见 :ref:`cn_api_paddle_incubate_asp_prune_model`。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _cn_api_paddle_incubate_asp_calculate_density: | ||
|
||
calculate_density | ||
------------------------------- | ||
|
||
.. py:function:: paddle.incubate.asp.calculate_density(x) | ||
返回输入 tensor 的密度。 | ||
|
||
参数 | ||
::::::::: | ||
|
||
**x** (nparray) – 输入 tensor。 | ||
|
||
返回 | ||
::::::::: | ||
|
||
**float** - x 的密度 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.incubate.asp.calculate_density |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.. _cn_api_paddle_incubate_asp_reset_excluded_layers: | ||
|
||
reset_excluded_layers | ||
------------------------------- | ||
|
||
.. py:function:: paddle.incubate.asp.reset_excluded_layers(main_program=None) | ||
重置与 `main_program` 对应的 excluded_layers 设置。如果 `main_program` 为 None,则 excepted_layers 的所有配置都将被清除。 | ||
|
||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **main_program** (Program,可选) - 包含模型定义及其参数的 Program。如果为 None,那么这个函数将重置所有 exclusion_layers。 默认为 None。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
1. 动态图模式 | ||
|
||
COPY-FROM: paddle.incubate.asp.reset_excluded_layers:dynamic-graph | ||
|
||
2. 静态图模式 | ||
|
||
COPY-FROM: paddle.incubate.asp.reset_excluded_layers:static-graph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.. _cn_api_paddle_incubate_asp_set_excluded_layers: | ||
|
||
set_excluded_layers | ||
------------------------------- | ||
|
||
.. py:function:: paddle.incubate.asp.set_excluded_layers(param_names, main_program=None) | ||
设置不会被裁剪为稀疏权重的 layer 的参数名称。 | ||
|
||
参数 | ||
::::::::: | ||
|
||
- **param_names** (list of string) - 包含参数名的列表 | ||
- **main_program** (Program,可选) - 包含模型定义及其参数的 Program。如果为 None,那么它将被设置为 paddle.static.default_main_program()。默认为 None。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
1. 动态图模式 | ||
|
||
COPY-FROM: paddle.incubate.asp.set_excluded_layers:dynamic-graph | ||
|
||
2. 静态图模式 | ||
|
||
COPY-FROM: paddle.incubate.asp.set_excluded_layers:static-graph |