diff --git a/doc/fluid/api/average.rst b/doc/fluid/api/average.rst deleted file mode 100644 index 82189c47b487051d02e9cc4f3570a242305c2c27..0000000000000000000000000000000000000000 --- a/doc/fluid/api/average.rst +++ /dev/null @@ -1,8 +0,0 @@ -============= -fluid.average -============= - -.. toctree:: - :maxdepth: 1 - - average/WeightedAverage.rst diff --git a/doc/fluid/api/average/WeightedAverage.rst b/doc/fluid/api/average/WeightedAverage.rst deleted file mode 100644 index 337b9c6ea88c79f2017dc1e77bd25e3fba3004ea..0000000000000000000000000000000000000000 --- a/doc/fluid/api/average/WeightedAverage.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_average_WeightedAverage: - -WeightedAverage ---------------- - -.. autoclass:: paddle.fluid.average.WeightedAverage - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api/data_feeder.rst b/doc/fluid/api/data_feeder.rst deleted file mode 100644 index e14292292cdece0cc8ac8df07b400214111b1b28..0000000000000000000000000000000000000000 --- a/doc/fluid/api/data_feeder.rst +++ /dev/null @@ -1,8 +0,0 @@ -================= -fluid.data_feeder -================= - -.. toctree:: - :maxdepth: 1 - - data_feeder/DataFeeder.rst diff --git a/doc/fluid/api/data_feeder/DataFeeder.rst b/doc/fluid/api/data_feeder/DataFeeder.rst deleted file mode 100644 index 3488bfc74f5c30dd00de3a2d18e277784b3165ae..0000000000000000000000000000000000000000 --- a/doc/fluid/api/data_feeder/DataFeeder.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_data_feeder_DataFeeder: - -DataFeeder ----------- - -.. autoclass:: paddle.fluid.data_feeder.DataFeeder - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api/dygraph.rst b/doc/fluid/api/dygraph.rst index 44d567828fdb0a8b15103cdc161fe2492b88665d..80177471d5b7d2a36486b8cdd84a6c87a3b7fbe3 100644 --- a/doc/fluid/api/dygraph.rst +++ b/doc/fluid/api/dygraph.rst @@ -14,7 +14,6 @@ fluid.dygraph dygraph/Conv3DTranspose.rst dygraph/CosineDecay.rst dygraph/Embedding.rst - dygraph/enabled.rst dygraph/ExponentialDecay.rst dygraph/FC.rst dygraph/GroupNorm.rst @@ -24,22 +23,17 @@ fluid.dygraph dygraph/Layer.rst dygraph/LayerNorm.rst dygraph/load_dygraph.rst - dygraph/load_persistables.rst dygraph/NaturalExpDecay.rst dygraph/NCE.rst dygraph/no_grad.rst dygraph/NoamDecay.rst - dygraph/not_support.rst dygraph/PiecewiseDecay.rst dygraph/PolynomialDecay.rst dygraph/Pool2D.rst dygraph/PRelu.rst dygraph/prepare_context.rst dygraph/save_dygraph.rst - dygraph/save_persistables.rst dygraph/SpectralNorm.rst - dygraph/start_gperf_profiler.rst - dygraph/stop_gperf_profiler.rst dygraph/to_variable.rst dygraph/Tracer.rst dygraph/TreeConv.rst diff --git a/doc/fluid/api/dygraph/enabled.rst b/doc/fluid/api/dygraph/enabled.rst deleted file mode 100644 index dc2bfa7649ef185be254a6a71161b613726e7449..0000000000000000000000000000000000000000 --- a/doc/fluid/api/dygraph/enabled.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_dygraph_enabled: - -enabled -------- - -.. autofunction:: paddle.fluid.dygraph.enabled - :noindex: - diff --git a/doc/fluid/api/dygraph/load_persistables.rst b/doc/fluid/api/dygraph/load_persistables.rst deleted file mode 100644 index 68c32c04ee863cd156516b368361f676ed4299cd..0000000000000000000000000000000000000000 --- a/doc/fluid/api/dygraph/load_persistables.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_dygraph_load_persistables: - -load_persistables ------------------ - -.. autofunction:: paddle.fluid.dygraph.load_persistables - :noindex: - diff --git a/doc/fluid/api/dygraph/not_support.rst b/doc/fluid/api/dygraph/not_support.rst deleted file mode 100644 index dcc54a34e69ade2ae79652c3595b483185de8910..0000000000000000000000000000000000000000 --- a/doc/fluid/api/dygraph/not_support.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_dygraph_not_support: - -not_support ------------ - -.. autofunction:: paddle.fluid.dygraph.not_support - :noindex: - diff --git a/doc/fluid/api/dygraph/save_persistables.rst b/doc/fluid/api/dygraph/save_persistables.rst deleted file mode 100644 index 42a3dacc70315d5f84b1761ad5097ec03657e4c0..0000000000000000000000000000000000000000 --- a/doc/fluid/api/dygraph/save_persistables.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_dygraph_save_persistables: - -save_persistables ------------------ - -.. autofunction:: paddle.fluid.dygraph.save_persistables - :noindex: - diff --git a/doc/fluid/api/dygraph/start_gperf_profiler.rst b/doc/fluid/api/dygraph/start_gperf_profiler.rst deleted file mode 100644 index a94f330088aa8b8fd32eceb4aabb96491f70630f..0000000000000000000000000000000000000000 --- a/doc/fluid/api/dygraph/start_gperf_profiler.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_dygraph_start_gperf_profiler: - -start_gperf_profiler --------------------- - -.. autofunction:: paddle.fluid.dygraph.start_gperf_profiler - :noindex: - diff --git a/doc/fluid/api/dygraph/stop_gperf_profiler.rst b/doc/fluid/api/dygraph/stop_gperf_profiler.rst deleted file mode 100644 index 500104d97058f0c3c9fa3f405e30a09bec994369..0000000000000000000000000000000000000000 --- a/doc/fluid/api/dygraph/stop_gperf_profiler.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_dygraph_stop_gperf_profiler: - -stop_gperf_profiler -------------------- - -.. autofunction:: paddle.fluid.dygraph.stop_gperf_profiler - :noindex: - diff --git a/doc/fluid/api/gen_doc.sh b/doc/fluid/api/gen_doc.sh index bed2cc41d3b05c27556079be797587da9ffc047b..1e833161ef0e225e4725136ad3d466d945b69bec 100644 --- a/doc/fluid/api/gen_doc.sh +++ b/doc/fluid/api/gen_doc.sh @@ -10,7 +10,7 @@ # python gen_doc.py --module_name layers.${module} --module_prefix layers --output layers/${module}.rst #done -for module in layers data_feeder dataset clip metrics executor initializer io nets optimizer profiler regularizer transpiler backward average profiler unique_name dygraph +for module in layers dataset clip metrics executor initializer io nets optimizer profiler regularizer transpiler backward profiler unique_name dygraph do python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --to_multiple_files True python gen_module_index.py ${module} fluid.${module} diff --git a/doc/fluid/api/index_en.rst b/doc/fluid/api/index_en.rst index 67c434c0b2082cf4ca1cbf0493380dd8dd9af3db..4e7bbf50dfa2825b617672f6320952e69f60757e 100644 --- a/doc/fluid/api/index_en.rst +++ b/doc/fluid/api/index_en.rst @@ -8,12 +8,10 @@ API Reference ../flags_en.rst ../api_guides/index_en.rst fluid.rst - average.rst backward.rst clip.rst data/data_reader.rst data/dataset.rst - data_feeder.rst dataset.rst dygraph.rst executor.rst diff --git a/doc/fluid/api/io.rst b/doc/fluid/api/io.rst index 19f431e30febbfbea68ff58e9ba5679ee4533762..b5ead2f497f1c07c5e6f864997b80a87b338633b 100644 --- a/doc/fluid/api/io.rst +++ b/doc/fluid/api/io.rst @@ -12,7 +12,6 @@ fluid.io io/compose.rst io/ComposeNotAligned.rst io/DataLoader.rst - io/Fake.rst io/firstn.rst io/load.rst io/load_inference_model.rst diff --git a/doc/fluid/api/io/Fake.rst b/doc/fluid/api/io/Fake.rst deleted file mode 100644 index c1efa2480423b8ab18f48847501de4619b0fbb84..0000000000000000000000000000000000000000 --- a/doc/fluid/api/io/Fake.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_io_Fake: - -Fake ----- - -.. autoclass:: paddle.fluid.io.Fake - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api/io/PipeReader.rst b/doc/fluid/api/io/PipeReader.rst deleted file mode 100644 index 4906760801fd6d040ca88a839d1fad012a0d1750..0000000000000000000000000000000000000000 --- a/doc/fluid/api/io/PipeReader.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_fluid_io_PipeReader: - -PipeReader --------- - -.. autoclass:: paddle.fluid.io.PipeReader - :members: - :inherited-members: - :noindex: - diff --git a/doc/fluid/api/layers.rst b/doc/fluid/api/layers.rst index 3cd939ae6a41a777f4f4093d724b923b11424fba..51a2e187bb5a56dcc94fa3dc81cb47327097afe7 100644 --- a/doc/fluid/api/layers.rst +++ b/doc/fluid/api/layers.rst @@ -70,7 +70,6 @@ fluid.layers layers/deformable_conv.rst layers/deformable_roi_pooling.rst layers/density_prior_box.rst - layers/detection_map.rst layers/detection_output.rst layers/diag.rst layers/dice_loss.rst @@ -97,6 +96,7 @@ fluid.layers layers/equal.rst layers/exp.rst layers/expand.rst + layers/expand_as.rst layers/exponential_decay.rst layers/eye.rst layers/fc.rst @@ -164,7 +164,6 @@ fluid.layers layers/lstm_unit.rst layers/LSTMCell.rst layers/margin_rank_loss.rst - layers/match_matrix_tensor.rst layers/matmul.rst layers/maxout.rst layers/mean.rst @@ -174,7 +173,6 @@ fluid.layers layers/mul.rst layers/multi_box_head.rst layers/multiclass_nms.rst - layers/multiclass_nms2.rst layers/multiplex.rst layers/MultivariateNormalDiag.rst layers/natural_exp_decay.rst @@ -301,7 +299,6 @@ fluid.layers layers/thresholded_relu.rst layers/topk.rst layers/transpose.rst - layers/tree_conv.rst layers/unfold.rst layers/Uniform.rst layers/uniform_random.rst @@ -310,7 +307,6 @@ fluid.layers layers/unique_with_counts.rst layers/unsqueeze.rst layers/unstack.rst - layers/var_conv_2d.rst layers/warpctc.rst layers/where.rst layers/While.rst diff --git a/doc/fluid/api/layers/detection_map.rst b/doc/fluid/api/layers/detection_map.rst deleted file mode 100644 index dc8f056e0302d41de09821c82266dfb1a35ff772..0000000000000000000000000000000000000000 --- a/doc/fluid/api/layers/detection_map.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_detection_map: - -detection_map -------------- - -.. autofunction:: paddle.fluid.layers.detection_map - :noindex: - diff --git a/doc/fluid/api/layers/tree_conv.rst b/doc/fluid/api/layers/expand_as.rst similarity index 55% rename from doc/fluid/api/layers/tree_conv.rst rename to doc/fluid/api/layers/expand_as.rst index b085631b08a8d19abb275aba3f8ef2c493ea1b4c..1f56fa0cdc5c2759405db041a6156d9e99208b4a 100644 --- a/doc/fluid/api/layers/tree_conv.rst +++ b/doc/fluid/api/layers/expand_as.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_layers_tree_conv: +.. _api_fluid_layers_expand_as: -tree_conv +expand_as --------- -.. autofunction:: paddle.fluid.layers.tree_conv +.. autofunction:: paddle.fluid.layers.expand_as :noindex: diff --git a/doc/fluid/api/layers/match_matrix_tensor.rst b/doc/fluid/api/layers/match_matrix_tensor.rst deleted file mode 100644 index 8f64af7b5b774782ba7f5ebd4104b0425a75ae8a..0000000000000000000000000000000000000000 --- a/doc/fluid/api/layers/match_matrix_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_match_matrix_tensor: - -match_matrix_tensor -------------------- - -.. autofunction:: paddle.fluid.layers.match_matrix_tensor - :noindex: - diff --git a/doc/fluid/api/layers/multiclass_nms2.rst b/doc/fluid/api/layers/multiclass_nms2.rst deleted file mode 100644 index a7da7cbc17cdc2714ca570454ab93e626a3f0b13..0000000000000000000000000000000000000000 --- 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/var_conv_2d.rst b/doc/fluid/api/layers/var_conv_2d.rst deleted file mode 100644 index 1edcb0aec9c3e0c0120b7dbe05483125e836112b..0000000000000000000000000000000000000000 --- a/doc/fluid/api/layers/var_conv_2d.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_var_conv_2d: - -var_conv_2d ------------ - -.. autofunction:: paddle.fluid.layers.var_conv_2d - :noindex: - diff --git a/doc/fluid/api_cn/.DS_Store b/doc/fluid/api_cn/.DS_Store deleted file mode 100644 index 3e5d3b695824eb929e40fea0051635ec4072d862..0000000000000000000000000000000000000000 Binary files a/doc/fluid/api_cn/.DS_Store and /dev/null differ diff --git a/doc/fluid/api_cn/average_cn.rst b/doc/fluid/api_cn/average_cn.rst deleted file mode 100644 index 252b0420c426286207a3d42d69333f60eb586477..0000000000000000000000000000000000000000 --- a/doc/fluid/api_cn/average_cn.rst +++ /dev/null @@ -1,11 +0,0 @@ -======================= -fluid.average -======================= - - - - -.. toctree:: - :maxdepth: 1 - - average_cn/WeightedAverage_cn.rst diff --git a/doc/fluid/api_cn/average_cn/WeightedAverage_cn.rst b/doc/fluid/api_cn/average_cn/WeightedAverage_cn.rst deleted file mode 100644 index 40f49c3dbfee8314ac0d87c2303e458472a69041..0000000000000000000000000000000000000000 --- a/doc/fluid/api_cn/average_cn/WeightedAverage_cn.rst +++ /dev/null @@ -1,65 +0,0 @@ -.. _cn_api_fluid_average_WeightedAverage: - -WeightedAverage -------------------------------- - -.. py:class:: paddle.fluid.average.WeightedAverage - -计算加权平均值。 - -平均计算完全通过Python完成。它们不会改变Paddle的程序,也不会修改NN模型的配置。它们完全是Python函数的包装器。 - -**示例代码** - -.. code-block:: python - - import paddle.fluid as fluid - avg = fluid.average.WeightedAverage() - avg.add(value=2.0, weight=1) - avg.add(value=4.0, weight=2) - avg.eval() - # 结果为 3.333333333. - # 因为 (2.0 * 1 + 4.0 * 2) / (1 + 2) = 3.333333333 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/fluid/api_cn/data_feeder_cn.rst b/doc/fluid/api_cn/data_feeder_cn.rst deleted file mode 100644 index 3a88f6e65e1582bbbec23314ef55800253fecd27..0000000000000000000000000000000000000000 --- a/doc/fluid/api_cn/data_feeder_cn.rst +++ /dev/null @@ -1,11 +0,0 @@ -======================= -fluid.data_feeder -======================= - - - - -.. toctree:: - :maxdepth: 1 - - data_feeder_cn/DataFeeder_cn.rst diff --git a/doc/fluid/api_cn/data_feeder_cn/DataFeeder_cn.rst b/doc/fluid/api_cn/data_feeder_cn/DataFeeder_cn.rst deleted file mode 100644 index d997cb3034155f7c7517bd2e7711ae8eb7c292bf..0000000000000000000000000000000000000000 --- a/doc/fluid/api_cn/data_feeder_cn/DataFeeder_cn.rst +++ /dev/null @@ -1,205 +0,0 @@ -.. _cn_api_fluid_data_feeder_DataFeeder: - -DataFeeder -------------------------------- - -.. py:class:: paddle.fluid.data_feeder.DataFeeder(feed_list, place, program=None) - - -``DataFeeder`` 负责将reader(数据读取函数)返回的数据转换为可以被 ``Executor`` 和 ``ParallelExecutor`` 解析的数据结构 - 用作executor的feed参数 -reader通常是一个用来从文件中读取/生成数据样本的自定义python生成器,该函数通常会返回一个包含样本实例数据的列表。 - -参数: - - **feed_list** (list) – 向模型输入的变量列表或者变量名列表 - - **place** (:ref:`cn_api_fluid_CPUPlace` | :ref:`cn_api_fluid_CUDAPlace` ) – place表明是向GPU还是CPU中输入数据。如果想向GPU中输入数据, 请使用 ``fluid.CUDAPlace(i)`` (i 代表 the GPU id);如果向CPU中输入数据, 请使用 ``fluid.CPUPlace()`` - - **program** (:ref:`cn_api_fluid_Program` ) – 需要向其中输入数据的Program。如果为None, 会默认使用 ``default_main_program()`` 。 缺省值为None - -异常情况: ``ValueError`` – 如果一些变量不在此 Program 中 - - -**代码示例** - -.. code-block:: python - - import numpy as np - import paddle - import paddle.fluid as fluid - - place = fluid.CPUPlace() - def reader(): - for _ in range(4): - yield np.random.random([4]).astype('float32'), np.random.random([3]).astype('float32'), - - main_program = fluid.Program() - startup_program = fluid.Program() - - with fluid.program_guard(main_program, startup_program): - data_1 = fluid.layers.data(name='data_1', shape=[-1, 2, 2]) - data_2 = fluid.layers.data(name='data_2', shape=[-1, 1, 3]) - out = fluid.layers.fc(input=[data_1, data_2], size=2) - # ... - feeder = fluid.DataFeeder([data_1, data_2], place) - - exe = fluid.Executor(place) - exe.run(startup_program) - - feed_data = feeder.feed(reader()) - - # print feed_data to view feed results - # print(feed_data['data_1']) - # print(feed_data['data_2']) - - outs = exe.run(program=main_program, - feed=feed_data, - fetch_list=[out]) - print(outs) - - -.. py:method:: feed(iterable) - - -根据创建DataFeeder时候传入的feed_list(变量列表) 和iterable (自定义python生成器) 将原始数据转换为tensor结构 - -参数: - - **iterable** (generator) – 自定义的python生成器,用来获取原始输入数据 - -返回:以变量名为key,tensor为value的dict - -返回类型: dict - -**代码示例** - -.. code-block:: python - - # 本示例中,reader函数会返回一个长度为3的数组,每个元素都是ndarray类型, - # 分别对应data_1, data_2, data_3的原始数据 - - # feed函数内部会将每个传入的ndarray转换为Paddle内部用于计算的tensor结构 - # 返回的结果是一个size为3的dict,key分别为data_1, data_2, data_3 - # result['data_1'] 为一个shape 为 [5, 2, 1, 3] 的LoD-tensor 其中5为batch size, [2, 1, 3]为data_1的shape - # result['data_2'], result['data_3']以此类推 - - import numpy as np - import paddle.fluid as fluid - - def reader(limit=5): - for i in range(1, limit + 1): - yield np.ones([6]).astype('float32') * i , np.ones([1]).astype('int64') * i, np.random.random([9]).astype('float32') - - data_1 = fluid.layers.data(name='data_1', shape=[2, 1, 3]) - data_2 = fluid.layers.data(name='data_2', shape=[1], dtype='int64') - data_3 = fluid.layers.data(name='data_3', shape=[3, 3], dtype='float32') - feeder = fluid.DataFeeder(['data_1','data_2', 'data_3'], fluid.CPUPlace()) - - - result = feeder.feed(reader()) - print(result['data_1']) - print(result['data_2']) - print(result['data_3']) - - -.. py:method:: feed_parallel(iterable, num_places=None) - -功能类似于 ``feed`` 函数,feed_parallel用于使用多个设备(CPU|GPU)的情况,iterable为自定义的生成器列表, -列表中的每个生成器返回的数据最后会feed到相对应的设备中 - - -参数: - - **iterable** (list(generator)) – 自定义的python生成器列表,列表元素个数与num_places保持一致 - - **num_places** (int) – 设备数目。默认为None。 - -返回: 返回值为dict的生成器,生成器返回一个键值对为 ``变量名-tensor`` 组成的dict - -返回类型: generator - -.. note:: - 设备(CPU或GPU)的数目 - ``num-places`` 必须等于 ``iterable`` 参数中的生成器数量 - -**代码示例** - -.. code-block:: python - - import numpy as np - import paddle.fluid as fluid - - def generate_reader(batch_size, base=0, factor=1): - def _reader(): - for i in range(batch_size): - yield np.ones([4]) * factor + base, np.ones([4]) * factor + base + 5 - return _reader() - - x = fluid.layers.data(name='x', shape=[-1, 2, 2]) - y = fluid.layers.data(name='y', shape=[-1, 2, 2], dtype='float32') - - z = fluid.layers.elementwise_add(x, y) - - feeder = fluid.DataFeeder(['x','y'], fluid.CPUPlace()) - place_num = 2 - places = [fluid.CPUPlace() for x in range(place_num)] - data = [] - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_startup_program()) - program = fluid.CompiledProgram(fluid.default_main_program()).with_data_parallel(places=places) - - # 打印feed_parallel结果示例 - # for item in list(feeder.feed_parallel([generate_reader(5, 0, 1), generate_reader(3, 10, 2)], 2)): - # print(item['x']) - # print(item['y']) - - reader_list = [generate_reader(5, 0, 1), generate_reader(3, 10, 2)] - res = exe.run(program=program, feed=list(feeder.feed_parallel(reader_list, 2)), fetch_list=[z]) - print(res) - - -.. py:method:: decorate_reader(reader, multi_devices, num_places=None, drop_last=True) - - -将reader返回的输入数据batch转换为多个mini-batch,之后每个mini-batch都会被输入进各个设备(CPU或GPU)中。 - -参数: - - **reader** (generator) – 一个用来自定义返回mini-batch的生成器,一个返回实例数据的reader可视为一个mini-batch(如下面例子中的 ``_mini_batch`` ) - - **multi_devices** (bool) – 指明是否使用多个设备 - - **num_places** (int,可选) – 如果 ``multi_devices`` 为 ``True`` , 可以使用此参数来设置设备数目。如果 ``num_places`` 为 ``None`` ,该函数默认使用当前训练机所有设备。默认为None。 - - **drop_last** (bool, 可选) – 如果最后一组数据的数量比设备数要小,则可使用该参数来指明是否选择丢弃最后一个组数据。 默认为 ``True`` - -返回:一个装饰之后的生成器,该生成器会返回匹配num_places数量的tensor数据列表 - -返回类型:generator - -异常情况: ValueError – 如果 ``drop_last`` 值为False并且最后一组数据的minibatch数目与设备数目不相等时,产生此异常 - -**代码示例** - -.. code-block:: python - - import numpy as np - import paddle - import paddle.fluid as fluid - import paddle.fluid.compiler as compiler - - def reader(): - def _mini_batch(batch_size): - for i in range(batch_size): - yield np.random.random([16]).astype('float32'), np.random.randint(10, size=[1]) - - for _ in range(10): - yield _mini_batch(np.random.randint(1, 10)) - - place_num = 3 - places = [fluid.CPUPlace() for _ in range(place_num)] - data = fluid.layers.data(name='data', shape=[-1, 4, 4], dtype='float32') - label = fluid.layers.data(name='label', shape=[-1, 1], dtype='int64') - - hidden = fluid.layers.fc(input=data, size=10) - - feeder = fluid.DataFeeder(place=places[0], feed_list=[data, label]) - reader = feeder.decorate_reader(reader, multi_devices=True, num_places=3, drop_last=True) - - exe = fluid.Executor(places[0]) - exe.run(fluid.default_startup_program()) - compiled_prog = compiler.CompiledProgram( - fluid.default_main_program()).with_data_parallel(places=places) - for i,data in enumerate(reader()): - ret = exe.run(compiled_prog, feed=data, fetch_list=[hidden]) - print(ret) - diff --git a/doc/fluid/api_cn/dygraph_cn.rst b/doc/fluid/api_cn/dygraph_cn.rst index 3c99efa844e1073996d578ac78b2cea96ca7f204..30ccb737fb0246eb58a0b0c859f6d41e9b3dbfaa 100644 --- a/doc/fluid/api_cn/dygraph_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn.rst @@ -29,12 +29,14 @@ fluid.dygraph dygraph_cn/NaturalExpDecay_cn.rst dygraph_cn/NCE_cn.rst dygraph_cn/NoamDecay_cn.rst - dygraph_cn/no_grad_cn.rst + dygraph_cn/no_grad_cn.rst dygraph_cn/PiecewiseDecay_cn.rst dygraph_cn/PolynomialDecay_cn.rst dygraph_cn/Pool2D_cn.rst dygraph_cn/PRelu_cn.rst + dygraph_cn/prepare_context_cn.rst dygraph_cn/save_dygraph_cn.rst dygraph_cn/SpectralNorm_cn.rst dygraph_cn/to_variable_cn.rst + dygraph_cn/Tracer_cn.rst dygraph_cn/TreeConv_cn.rst diff --git a/doc/fluid/api_cn/fluid_cn.rst b/doc/fluid/api_cn/fluid_cn.rst index 13390e15d2081a87622766f0799c46fdf4d97871..054f39e772568dee67df2cb37acc0e81efc1857a 100644 --- a/doc/fluid/api_cn/fluid_cn.rst +++ b/doc/fluid/api_cn/fluid_cn.rst @@ -31,6 +31,9 @@ fluid fluid_cn/global_scope_cn.rst fluid_cn/gradients_cn.rst fluid_cn/in_dygraph_mode_cn.rst + fluid_cn/is_compiled_with_cuda_cn.rst + fluid_cn/load_cn.rst + fluid_cn/load_op_library_cn.rst fluid_cn/LoDTensor_cn.rst fluid_cn/LoDTensorArray_cn.rst fluid_cn/memory_optimize_cn.rst @@ -41,6 +44,8 @@ fluid fluid_cn/Program_cn.rst fluid_cn/program_guard_cn.rst fluid_cn/release_memory_cn.rst + fluid_cn/require_version_cn.rst + fluid_cn/save_cn.rst fluid_cn/scope_guard_cn.rst fluid_cn/Tensor_cn.rst fluid_cn/Variable_cn.rst diff --git a/doc/fluid/api_cn/io_cn.rst b/doc/fluid/api_cn/io_cn.rst index ca5647d913a69c3b0e6ac8891e83fa5a1cdb86d3..0f86246d7bdd316b0e2e623732e253d81954b904 100644 --- a/doc/fluid/api_cn/io_cn.rst +++ b/doc/fluid/api_cn/io_cn.rst @@ -14,7 +14,9 @@ fluid.io io_cn/cache_cn.rst io_cn/chain_cn.rst io_cn/compose_cn.rst - io_cn/Fake_cn.rst + io_cn/ComposeNotAligned_cn.rst + io_cn/DataLoader_cn.rst + io_cn/Fake_cn.rst io_cn/firstn_cn.rst io_cn/load_cn.rst io_cn/load_inference_model_cn.rst @@ -23,7 +25,6 @@ fluid.io io_cn/load_vars_cn.rst io_cn/map_readers_cn.rst io_cn/multiprocess_reader_cn.rst - io_cn/PipeReader_cn.rst io_cn/PyReader_cn.rst io_cn/save_cn.rst io_cn/save_inference_model_cn.rst diff --git a/doc/fluid/api_cn/layers_cn.rst b/doc/fluid/api_cn/layers_cn.rst index 666c38211065818568c284091026c29a9ac734bb..8fa27306dd82bcf63c7db54da93f00cfae785dcf 100644 --- a/doc/fluid/api_cn/layers_cn.rst +++ b/doc/fluid/api_cn/layers_cn.rst @@ -74,7 +74,6 @@ fluid.layers layers_cn/deformable_conv_cn.rst layers_cn/deformable_roi_pooling_cn.rst layers_cn/density_prior_box_cn.rst - layers_cn/detection_map_cn.rst layers_cn/detection_output_cn.rst layers_cn/diag_cn.rst layers_cn/dice_loss_cn.rst @@ -102,6 +101,7 @@ fluid.layers layers_cn/equal_cn.rst layers_cn/exp_cn.rst layers_cn/expand_cn.rst + layers_cn/expend_as_cn.rst layers_cn/exponential_decay_cn.rst layers_cn/eye_cn.rst layers_cn/fc_cn.rst @@ -202,6 +202,7 @@ fluid.layers layers_cn/prelu_cn.rst layers_cn/Print_cn.rst layers_cn/prior_box_cn.rst + layers_cn/prroi_pool_cn.rst layers_cn/psroi_pool_cn.rst layers_cn/py_func_cn.rst layers_cn/py_reader_cn.rst diff --git a/doc/fluid/api_cn/optimizer_cn.rst b/doc/fluid/api_cn/optimizer_cn.rst index 8c1a2d3dfa50a204a250f1c8295cb7eeb3b17c71..56c9c5286b0a739eabcf86aa1454347bf6ec543f 100644 --- a/doc/fluid/api_cn/optimizer_cn.rst +++ b/doc/fluid/api_cn/optimizer_cn.rst @@ -19,18 +19,20 @@ fluid.optimizer optimizer_cn/DecayedAdagrad_cn.rst optimizer_cn/DecayedAdagradOptimizer_cn.rst optimizer_cn/DGCMomentumOptimizer_cn.rst + optimizer_cn/Dpsgd_cn.rst + optimizer_cn/DpsgdOptimizer_cn.rst optimizer_cn/ExponentialMovingAverage_cn.rst optimizer_cn/Ftrl_cn.rst optimizer_cn/FtrlOptimizer_cn.rst optimizer_cn/LambOptimizer_cn.rst optimizer_cn/LarsMomentum_cn.rst optimizer_cn/LarsMomentumOptimizer_cn.rst + optimizer_cn/LookaheadOptimizer_cn.rst optimizer_cn/ModelAverage_cn.rst optimizer_cn/Momentum_cn.rst optimizer_cn/MomentumOptimizer_cn.rst optimizer_cn/PipelineOptimizer_cn.rst + optimizer_cn/RecomputeOptimizer_cn.rst optimizer_cn/RMSPropOptimizer_cn.rst optimizer_cn/SGD_cn.rst optimizer_cn/SGDOptimizer_cn.rst - optimizer_cn/LookaheadOptimizer_cn.rst - optimizer_cn/RecomputeOptimizer_cn.rst