未验证 提交 5867e69f 编写于 作者: C Chen Long 提交者: GitHub

Fix wrong pages (#2362)

* fix wrong pages test=develop

* fix en wrong pages test=develop

* fix declarative_cn.rst, test=release/1.8
上级 e2a3c42f
......@@ -18,10 +18,7 @@ fluid.dygraph
dygraph/disable_dygraph.rst
dygraph/disable_imperative.rst
dygraph/Dropout.rst
dygraph/dygraph_to_static_code.rst
dygraph/dygraph_to_static_func.rst
dygraph/dygraph_to_static_output.rst
dygraph/dygraph_to_static_program.rst
dygraph/declarative.rst
dygraph/Embedding.rst
dygraph/enable_dygraph.rst
dygraph/enable_imperative.rst
......@@ -29,7 +26,6 @@ fluid.dygraph
dygraph/ExponentialDecay.rst
dygraph/grad.rst
dygraph/GroupNorm.rst
dygraph/GRUCell.rst
dygraph/GRUUnit.rst
dygraph/guard.rst
dygraph/InstanceNorm.rst
......@@ -40,7 +36,6 @@ fluid.dygraph
dygraph/LayerNorm.rst
dygraph/Linear.rst
dygraph/load_dygraph.rst
dygraph/LSTMCell.rst
dygraph/MSELoss.rst
dygraph/NaturalExpDecay.rst
dygraph/NCE.rst
......
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_GRUCell:
GRUCell
-------
.. autoclass:: paddle.fluid.dygraph.GRUCell
:members:
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_LSTMCell:
LSTMCell
--------
.. autoclass:: paddle.fluid.dygraph.LSTMCell
:members:
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_dygraph_to_static_code:
dygraph_to_static_code
----------------------
.. autofunction:: paddle.fluid.dygraph.dygraph_to_static_code
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_dygraph_to_static_func:
dygraph_to_static_func
----------------------
.. autofunction:: paddle.fluid.dygraph.dygraph_to_static_func
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_dygraph_to_static_output:
dygraph_to_static_output
------------------------
.. autofunction:: paddle.fluid.dygraph.dygraph_to_static_output
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_dygraph_to_static_program:
dygraph_to_static_program
-------------------------
.. autofunction:: paddle.fluid.dygraph.dygraph_to_static_program
:noindex:
......@@ -9,8 +9,6 @@ fluid.initializer
initializer/BilinearInitializer.rst
initializer/Constant.rst
initializer/ConstantInitializer.rst
initializer/force_init_on_cpu.rst
initializer/init_on_cpu.rst
initializer/MSRA.rst
initializer/MSRAInitializer.rst
initializer/Normal.rst
......
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_initializer_force_init_on_cpu:
force_init_on_cpu
-----------------
.. autofunction:: paddle.fluid.initializer.force_init_on_cpu
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_initializer_init_on_cpu:
init_on_cpu
-----------
.. autofunction:: paddle.fluid.initializer.init_on_cpu
:noindex:
......@@ -21,7 +21,6 @@ fluid.dygraph
dygraph_cn/declarative_cn.rst
dygraph_cn/Embedding_cn.rst
dygraph_cn/ExponentialDecay_cn.rst
dygraph_cn/FC_cn.rst
dygraph_cn/grad_cn.rst
dygraph_cn/GroupNorm_cn.rst
dygraph_cn/GRUUnit_cn.rst
......
.. _cn_api_fluid_dygraph_FC:
FC
-------------------------------
:api_attr: 命令式编程模式(动态图)
.. py:class:: paddle.fluid.dygraph.FC(name_scope, size, num_flatten_dims=1, param_attr=None, bias_attr=None, act=None, is_test=False, dtype='float32')
.. note::
该api已经被删除,请使用 ``Linear`` 接口,具体请参考 :ref:`cn_api_fluid_dygraph_Linear` 。
.. _cn_api_fluid_dygraph_declarative:
declarative
-------------------------------
---------
**版本升级,文档正在开发中**
......@@ -12,8 +12,6 @@ fluid.initializer
initializer_cn/BilinearInitializer_cn.rst
initializer_cn/Constant_cn.rst
initializer_cn/ConstantInitializer_cn.rst
initializer_cn/force_init_on_cpu_cn.rst
initializer_cn/init_on_cpu_cn.rst
initializer_cn/MSRA_cn.rst
initializer_cn/MSRAInitializer_cn.rst
initializer_cn/Normal_cn.rst
......
.. _cn_api_fluid_initializer_force_init_on_cpu:
force_init_on_cpu
-------------------------------
.. py:function:: paddle.fluid.initializer.force_init_on_cpu()
该接口获得一个是否强制在CPU上初始化变量的布尔型标志位。
返回
::::::::::::
状态,是否应强制在CPU上强制进行变量初始化
返回类型
::::::::::::
bool
代码示例
::::::::::::
.. code-block:: python
import paddle.fluid as fluid
if fluid.initializer.force_init_on_cpu():
step = fluid.layers.create_global_var(shape=[2,3], value=1.0, dtype='float32')
.. _cn_api_fluid_initializer_init_on_cpu:
init_on_cpu
-------------------------------
.. py:function:: paddle.fluid.initializer.init_on_cpu()
该接口设置强制变量在 cpu 上初始化。
返回
::::::::::::
代码示例
::::::::::::
.. code-block:: python
import paddle.fluid as fluid
with fluid.initializer.init_on_cpu():
step = fluid.layers.create_global_var(shape=[2,3], value=1.0, dtype='float32')
......@@ -157,6 +157,7 @@ fluid.layers
layers_cn/increment_cn.rst
layers_cn/inverse_time_decay_cn.rst
layers_cn/index_select_cn.rst
layers_cn/inplace_abn_cn.rst
layers_cn/index_sample_cn.rst
layers_cn/instance_norm_cn.rst
layers_cn/interpolate_cn.rst
......@@ -175,6 +176,7 @@ fluid.layers
layers_cn/linear_lr_warmup_cn.rst
layers_cn/linspace_cn.rst
layers_cn/load_cn.rst
layers_cn/locality_aware_nms_cn.rst
layers_cn/lod_append_cn.rst
layers_cn/lod_reset_cn.rst
layers_cn/log_cn.rst
......@@ -192,7 +194,6 @@ fluid.layers
layers_cn/lstm_unit_cn.rst
layers_cn/LSTMCell_cn.rst
layers_cn/margin_rank_loss_cn.rst
layers_cn/masked_select_cn.rst
layers_cn/matmul_cn.rst
layers_cn/maxout_cn.rst
layers_cn/mean_cn.rst
......@@ -294,13 +295,13 @@ fluid.layers
layers_cn/shape_cn.rst
layers_cn/shard_index_cn.rst
layers_cn/shuffle_channel_cn.rst
layers_cn/shuffle_cn.rst
layers_cn/sigmoid_cn.rst
layers_cn/sigmoid_cross_entropy_with_logits_cn.rst
layers_cn/sigmoid_focal_loss_cn.rst
layers_cn/sign_cn.rst
layers_cn/similarity_focus_cn.rst
layers_cn/sin_cn.rst
layers_cn/size_cn.rst
layers_cn/slice_cn.rst
layers_cn/smooth_l1_cn.rst
layers_cn/soft_relu_cn.rst
......
.. _cn_api_tensor_search_index_sample:
index_sample
-------------------------------
.. py:function:: paddle.fluid.layers.index_sample(x, index)
该OP实现对输入 ``x`` 中的元素进行批量抽样,取 ``index`` 指定的对应下标的元素,按index中出现的先后顺序组织,填充为一个新的张量。
该OP中 ``x`` 与 ``index`` 都是 ``2-D`` 张量。 ``index`` 的第一维度与输入 ``x`` 的第一维度必须相同, ``index`` 的第二维度没有大小要求,可以重复索引相同下标元素。
参数
::::::::::::
- **x** (Variable)– 输入的二维张量,数据类型为 int32,int64,float32,float64。
- **index** (Variable)– 包含索引下标的二维张量。数据类型为 int32,int64。
返回
::::::::::::
-**Variable** ,数据类型与输入 ``x`` 相同,维度与 ``index`` 相同。
代码示例
::::::::::::
.. code-block:: python
import paddle
import paddle.fluid as fluid
import numpy as np
data = np.array([[1.0, 2.0, 3.0, 4.0],
[5.0, 6.0, 7.0, 8.0],
[9.0, 10.0, 11.0, 12.0]]).astype('float32')
data_index = np.array([[0, 1, 2],
[1, 2, 3],
[0, 0, 0]]).astype('int32')
target_data = np.array([[100, 200, 300, 400],
[500, 600, 700, 800],
[900, 1000, 1100, 1200]]).astype('int32')
with fluid.dygraph.guard():
x = fluid.dygraph.to_variable(data)
index = fluid.dygraph.to_variable(data_index)
target = fluid.dygraph.to_variable(target_data)
out_z1 = fluid.layers.index_sample(x, index)
print(out_z1.numpy())
#[[1. 2. 3.]
# [6. 7. 8.]
# [9. 9. 9.]]
# 巧妙用法:使用topk op产出的top元素的下标
# 在另一个tensor中索引对应位置的元素
top_value, top_index = fluid.layers.topk(x, k=2)
out_z2 = fluid.layers.index_sample(target, top_index)
print(top_value.numpy())
#[[ 4. 3.]
# [ 8. 7.]
# [12. 11.]]
print(top_index.numpy())
#[[3 2]
# [3 2]
# [3 2]]
print(out_z2.numpy())
#[[ 400 300]
# [ 800 700]
# [1200 1100]]
.. _cn_api_fluid_layers_shuffle:
shuffle
-------------------------------
.. py:function:: paddle.fluid.layers.shuffle(reader, buffer_size)
创建一个特殊的数据读取器,它的输出数据会被重洗(shuffle)。由原始读取器创建的迭代器得到的输出将会被暂存到shuffle缓存区,其后
会对其进行重洗运算。shuffle缓存区的大小由参数 ``buffer_size`` 决定。
参数
::::::::::::
- **reader** (callable) – 输出会被shuffle的原始reader
- **buffer_size** (int) – 进行shuffle的buffer的大小
返回
::::::::::::
其输出会被shuffle的一个reader(读取器)
返回类型
::::::::::::
callable
代码示例
::::::::::::
.. code-block:: python
import paddle.fluid as fluid
raw_reader = fluid.layers.io.open_files(filenames=['./data1.recordio',
'./data2.recordio'],
shapes=[(3,224,224), (1,)],
lod_levels=[0, 0],
dtypes=['float32', 'int64'],
thread_num=2,
buffer_size=2)
batch_reader = fluid.layers.batch(reader=raw_reader, batch_size=5)
shuffle_reader = fluid.layers.shuffle(reader=batch_reader, buffer_size=5000)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册