From e8d97639dd3d28817a4ca27bc65f0c32e24f1fc9 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Tue, 8 Oct 2019 09:36:18 +0800 Subject: [PATCH] Revert "Polish seven minimize Chinese APIs' doc of Optimizer (#1200)" (#1457) This reverts commit a29dcbec8420e412028c02a4f8135829a8ffee1c. --- doc/fluid/api/layers/Categorical.rst | 13 ------ .../api/layers/MultivariateNormalDiag.rst | 13 ------ doc/fluid/api/layers/crop_tensor.rst | 11 ----- doc/fluid/api/layers/gather_nd.rst | 11 ----- doc/fluid/api/layers/multiclass_nms2.rst | 11 ----- doc/fluid/api/layers/prroi_pool.rst | 11 ----- doc/fluid/api/layers/scatter_nd.rst | 11 ----- doc/fluid/api/layers/scatter_nd_add.rst | 11 ----- .../api/layers/sequence_topk_avg_pooling.rst | 11 ----- doc/fluid/api/layers/strided_slice.rst | 11 ----- .../api/optimizer/LookaheadOptimizer.rst | 13 ------ .../optimizer_cn/AdagradOptimizer_cn.rst | 36 ++++----------- .../api_cn/optimizer_cn/AdamOptimizer_cn.rst | 42 ++++------------- .../optimizer_cn/AdamaxOptimizer_cn.rst | 37 +++++---------- .../DecayedAdagradOptimizer_cn.rst | 38 ++++----------- .../optimizer_cn/MomentumOptimizer_cn.rst | 46 ++++--------------- .../optimizer_cn/RMSPropOptimizer_cn.rst | 46 ++++--------------- .../api_cn/optimizer_cn/SGDOptimizer_cn.rst | 46 ++++--------------- 18 files changed, 71 insertions(+), 347 deletions(-) delete mode 100644 doc/fluid/api/layers/Categorical.rst delete mode 100644 doc/fluid/api/layers/MultivariateNormalDiag.rst delete mode 100644 doc/fluid/api/layers/crop_tensor.rst delete mode 100644 doc/fluid/api/layers/gather_nd.rst delete mode 100644 doc/fluid/api/layers/multiclass_nms2.rst delete mode 100644 doc/fluid/api/layers/prroi_pool.rst delete mode 100644 doc/fluid/api/layers/scatter_nd.rst delete mode 100644 doc/fluid/api/layers/scatter_nd_add.rst delete mode 100644 doc/fluid/api/layers/sequence_topk_avg_pooling.rst delete mode 100644 doc/fluid/api/layers/strided_slice.rst delete mode 100644 doc/fluid/api/optimizer/LookaheadOptimizer.rst diff --git a/doc/fluid/api/layers/Categorical.rst b/doc/fluid/api/layers/Categorical.rst deleted file mode 100644 index dde7a3fb8..000000000 --- a/doc/fluid/api/layers/Categorical.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_Categorical: - -Categorical ------------ - -.. autoclass:: paddle.fluid.layers.Categorical - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api/layers/MultivariateNormalDiag.rst b/doc/fluid/api/layers/MultivariateNormalDiag.rst deleted file mode 100644 index d8579af75..000000000 --- a/doc/fluid/api/layers/MultivariateNormalDiag.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_MultivariateNormalDiag: - -MultivariateNormalDiag ----------------------- - -.. autoclass:: paddle.fluid.layers.MultivariateNormalDiag - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api/layers/crop_tensor.rst b/doc/fluid/api/layers/crop_tensor.rst deleted file mode 100644 index 205de5d01..000000000 --- a/doc/fluid/api/layers/crop_tensor.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_crop_tensor: - -crop_tensor ------------ - -.. autofunction:: paddle.fluid.layers.crop_tensor - :noindex: - diff --git a/doc/fluid/api/layers/gather_nd.rst b/doc/fluid/api/layers/gather_nd.rst deleted file mode 100644 index 6376234a5..000000000 --- a/doc/fluid/api/layers/gather_nd.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_gather_nd: - -gather_nd ---------- - -.. autofunction:: paddle.fluid.layers.gather_nd - :noindex: - diff --git a/doc/fluid/api/layers/multiclass_nms2.rst b/doc/fluid/api/layers/multiclass_nms2.rst deleted file mode 100644 index a7da7cbc1..000000000 --- a/doc/fluid/api/layers/multiclass_nms2.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_multiclass_nms2: - -multiclass_nms2 ---------------- - -.. autofunction:: paddle.fluid.layers.multiclass_nms2 - :noindex: - diff --git a/doc/fluid/api/layers/prroi_pool.rst b/doc/fluid/api/layers/prroi_pool.rst deleted file mode 100644 index 609efc5bf..000000000 --- a/doc/fluid/api/layers/prroi_pool.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_prroi_pool: - -prroi_pool ----------- - -.. autofunction:: paddle.fluid.layers.prroi_pool - :noindex: - diff --git a/doc/fluid/api/layers/scatter_nd.rst b/doc/fluid/api/layers/scatter_nd.rst deleted file mode 100644 index 4d5a160e5..000000000 --- a/doc/fluid/api/layers/scatter_nd.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_scatter_nd: - -scatter_nd ----------- - -.. autofunction:: paddle.fluid.layers.scatter_nd - :noindex: - diff --git a/doc/fluid/api/layers/scatter_nd_add.rst b/doc/fluid/api/layers/scatter_nd_add.rst deleted file mode 100644 index 94eb1306e..000000000 --- a/doc/fluid/api/layers/scatter_nd_add.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_scatter_nd_add: - -scatter_nd_add --------------- - -.. autofunction:: paddle.fluid.layers.scatter_nd_add - :noindex: - diff --git a/doc/fluid/api/layers/sequence_topk_avg_pooling.rst b/doc/fluid/api/layers/sequence_topk_avg_pooling.rst deleted file mode 100644 index 9ad6824c5..000000000 --- a/doc/fluid/api/layers/sequence_topk_avg_pooling.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_sequence_topk_avg_pooling: - -sequence_topk_avg_pooling -------------------------- - -.. autofunction:: paddle.fluid.layers.sequence_topk_avg_pooling - :noindex: - diff --git a/doc/fluid/api/layers/strided_slice.rst b/doc/fluid/api/layers/strided_slice.rst deleted file mode 100644 index 310c861f5..000000000 --- a/doc/fluid/api/layers/strided_slice.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_layers_strided_slice: - -strided_slice -------------- - -.. autofunction:: paddle.fluid.layers.strided_slice - :noindex: - diff --git a/doc/fluid/api/optimizer/LookaheadOptimizer.rst b/doc/fluid/api/optimizer/LookaheadOptimizer.rst deleted file mode 100644 index 5d95ced52..000000000 --- a/doc/fluid/api/optimizer/LookaheadOptimizer.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_optimizer_LookaheadOptimizer: - -LookaheadOptimizer ------------------- - -.. autoclass:: paddle.fluid.optimizer.LookaheadOptimizer - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api_cn/optimizer_cn/AdagradOptimizer_cn.rst b/doc/fluid/api_cn/optimizer_cn/AdagradOptimizer_cn.rst index 4493a62b7..18ca8c780 100644 --- a/doc/fluid/api_cn/optimizer_cn/AdagradOptimizer_cn.rst +++ b/doc/fluid/api_cn/optimizer_cn/AdagradOptimizer_cn.rst @@ -51,39 +51,23 @@ Adaptive Gradient 优化器(自适应梯度优化器,简称Adagrad)可以针 .. py:method:: minimize(loss, startup_program=None, parameter_list=None, no_grad_set=None, grad_clip=None) -为网络添加反向计算过程,并根据反向计算所得的梯度,更新parameter_list中的Parameters,最小化网络损失值loss。 -参数: - - **loss** (Variable) – 需要最小化的损失值变量 - - **startup_program** (Program, 可选) – 用于初始化parameter_list中参数的 :ref:`cn_api_fluid_Program` , 默认值为None,此时将使用 :ref:`cn_api_fluid_default_startup_program` - - **parameter_list** (list, 可选) – 待更新的Parameter组成的列表, 默认值为None,此时将更新所有的Parameter - - **no_grad_set** (set, 可选) – 不需要更新的Parameter的集合,默认值为None - - **grad_clip** (GradClipBase, 可选) – 梯度裁剪的策略,静态图模式不需要使用本参数,当前本参数只支持在dygraph模式下的梯度裁剪,未来本参数可能会调整,默认值为None +通过更新parameter_list来添加操作,进而使损失最小化。 -返回: (optimize_ops, params_grads),数据类型为(list, list),其中optimize_ops是minimize接口为网络添加的OP列表,params_grads是一个由(param, grad)变量对组成的列表,param是Parameter,grad是该Parameter对应的梯度值 +该算子相当于backward()和apply_gradients()功能的合体。 -返回类型: tuple +参数: + - **loss** (Variable) – 用于优化过程的损失值变量 + - **startup_program** (Program) – 用于初始化在parameter_list中参数的startup_program + - **parameter_list** (list) – 待更新的Variables组成的列表 + - **no_grad_set** (set|None) – 应该被无视的Variables集合 + - **grad_clip** (GradClipBase|None) – 梯度裁剪的策略 -**代码示例** +返回: (optimize_ops, params_grads),分别为附加的算子列表;一个由(param, grad) 变量对组成的列表,用于优化 -.. code-block:: python +返回类型: tuple - import numpy as np - import paddle.fluid as fluid - - inp = fluid.layers.data( - name="inp", shape=[2, 2], append_batch_size=False) - out = fluid.layers.fc(inp, size=3) - out = fluid.layers.reduce_sum(out) - optimizer = fluid.optimizer.AdagradOptimizer(learning_rate=0.2) - optimizer.minimize(out) - np_inp = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_startup_program()) - exe.run( - feed={"inp": np_inp}, - fetch_list=[out.name]) diff --git a/doc/fluid/api_cn/optimizer_cn/AdamOptimizer_cn.rst b/doc/fluid/api_cn/optimizer_cn/AdamOptimizer_cn.rst index f6708c74d..f4fb231de 100644 --- a/doc/fluid/api_cn/optimizer_cn/AdamOptimizer_cn.rst +++ b/doc/fluid/api_cn/optimizer_cn/AdamOptimizer_cn.rst @@ -62,43 +62,21 @@ Adam优化器出自 `Adam论文 `_ 的第二节 .. py:method:: minimize(loss, startup_program=None, parameter_list=None, no_grad_set=None, grad_clip=None) -为网络添加反向计算过程,并根据反向计算所得的梯度,更新parameter_list中的Parameters,最小化网络损失值loss。 -参数: - - **loss** (Variable) – 需要最小化的损失值变量 - - **startup_program** (Program, 可选) – 用于初始化parameter_list中参数的 :ref:`cn_api_fluid_Program` , 默认值为None,此时将使用 :ref:`cn_api_fluid_default_startup_program` - - **parameter_list** (list, 可选) – 待更新的Parameter组成的列表, 默认值为None,此时将更新所有的Parameter - - **no_grad_set** (set, 可选) – 不需要更新的Parameter的集合,默认值为None - - **grad_clip** (GradClipBase, 可选) – 梯度裁剪的策略,静态图模式不需要使用本参数,当前本参数只支持在dygraph模式下的梯度裁剪,未来本参数可能会调整,默认值为None - -返回: (optimize_ops, params_grads),数据类型为(list, list),其中optimize_ops是minimize接口为网络添加的OP列表,params_grads是一个由(param, grad)变量对组成的列表,param是Parameter,grad是该Parameter对应的梯度值 +通过更新parameter_list来添加操作,进而使损失最小化。 -返回类型: tuple +该算子相当于backward()和apply_gradients()功能的合体。 -**代码示例**: +参数: + - **loss** (Variable) – 用于优化过程的损失值变量 + - **startup_program** (Program) – 用于初始化在parameter_list中参数的startup_program + - **parameter_list** (list) – 待更新的Variables组成的列表 + - **no_grad_set** (set|None) – 应该被无视的Variables集合 + - **grad_clip** (GradClipBase|None) – 梯度裁剪的策略 -.. code-block:: python +返回: (optimize_ops, params_grads),分别为附加的算子列表;一个由(param, grad) 变量对组成的列表,用于优化 - import numpy - import paddle.fluid as fluid - - x = fluid.layers.data(name='X', shape=[13], dtype='float32') - y = fluid.layers.data(name='Y', shape=[1], dtype='float32') - y_predict = fluid.layers.fc(input=x, size=1, act=None) - cost = fluid.layers.square_error_cost(input=y_predict, label=y) - loss = fluid.layers.mean(cost) - adam = fluid.optimizer.AdamOptimizer(learning_rate=0.2) - adam.minimize(loss) - - place = fluid.CPUPlace() # fluid.CUDAPlace(0) - exe = fluid.Executor(place) - - x = numpy.random.random(size=(10, 13)).astype('float32') - y = numpy.random.random(size=(10, 1)).astype('float32') - exe.run(fluid.default_startup_program()) - outs = exe.run(program=fluid.default_main_program(), - feed={'X': x, 'Y': y}, - fetch_list=[loss.name]) +返回类型: tuple diff --git a/doc/fluid/api_cn/optimizer_cn/AdamaxOptimizer_cn.rst b/doc/fluid/api_cn/optimizer_cn/AdamaxOptimizer_cn.rst index 85b3817d4..3c65d9e87 100644 --- a/doc/fluid/api_cn/optimizer_cn/AdamaxOptimizer_cn.rst +++ b/doc/fluid/api_cn/optimizer_cn/AdamaxOptimizer_cn.rst @@ -65,38 +65,23 @@ Adamax优化器是参考 `Adam论文 `_ 第7节 .. py:method:: minimize(loss, startup_program=None, parameter_list=None, no_grad_set=None, grad_clip=None) -为网络添加反向计算过程,并根据反向计算所得的梯度,更新parameter_list中的Parameters,最小化网络损失值loss。 -参数: - - **loss** (Variable) – 需要最小化的损失值变量 - - **startup_program** (Program, 可选) – 用于初始化parameter_list中参数的 :ref:`cn_api_fluid_Program` , 默认值为None,此时将使用 :ref:`cn_api_fluid_default_startup_program` - - **parameter_list** (list, 可选) – 待更新的Parameter组成的列表, 默认值为None,此时将更新所有的Parameter - - **no_grad_set** (set, 可选) – 不需要更新的Parameter的集合,默认值为None - - **grad_clip** (GradClipBase, 可选) – 梯度裁剪的策略,静态图模式不需要使用本参数,当前本参数只支持在dygraph模式下的梯度裁剪,未来本参数可能会调整,默认值为None +通过更新parameter_list来添加操作,进而使损失最小化。 -返回: (optimize_ops, params_grads),数据类型为(list, list),其中optimize_ops是minimize接口为网络添加的OP列表,params_grads是一个由(param, grad)变量对组成的列表,param是Parameter,grad是该Parameter对应的梯度值 +该算子相当于backward()和apply_gradients()功能的合体。 -**代码示例**: +参数: + - **loss** (Variable) – 用于优化过程的损失值变量 + - **startup_program** (Program) – 用于初始化在parameter_list中参数的startup_program + - **parameter_list** (list) – 待更新的Variables组成的列表 + - **no_grad_set** (set|None) – 应该被无视的Variables集合 + - **grad_clip** (GradClipBase|None) – 梯度裁剪的策略 -.. code-block:: python +返回: (optimize_ops, params_grads),分别为附加的算子列表;一个由(param, grad) 变量对组成的列表,用于优化 + +返回类型: tuple - import numpy - import paddle.fluid as fluid - - data = fluid.layers.data(name='X', shape=[1], dtype='float32') - hidden = fluid.layers.fc(input=data, size=10) - loss = fluid.layers.mean(hidden) - adam = fluid.optimizer.Adamax(learning_rate=0.2) - adam.minimize(loss) - place = fluid.CPUPlace() # fluid.CUDAPlace(0) - exe = fluid.Executor(place) - - x = numpy.random.random(size=(10, 1)).astype('float32') - exe.run(fluid.default_startup_program()) - outs = exe.run(program=fluid.default_main_program(), - feed={'X': x}, - fetch_list=[loss.name]) diff --git a/doc/fluid/api_cn/optimizer_cn/DecayedAdagradOptimizer_cn.rst b/doc/fluid/api_cn/optimizer_cn/DecayedAdagradOptimizer_cn.rst index 0cbf2e87f..e6d6c3bef 100644 --- a/doc/fluid/api_cn/optimizer_cn/DecayedAdagradOptimizer_cn.rst +++ b/doc/fluid/api_cn/optimizer_cn/DecayedAdagradOptimizer_cn.rst @@ -45,37 +45,19 @@ Decayed Adagrad优化器,可以看做是引入了衰减率的 `Adagrad