From ede6af7121aabc4793f7e311b1980cf2bd13ddf8 Mon Sep 17 00:00:00 2001 From: Tink_Y <31891223+tink2123@users.noreply.github.com> Date: Tue, 14 Aug 2018 17:25:04 +0800 Subject: [PATCH] update api_reference (#42) --- source/api_reference/CMakeLists.txt | 25 ++++++ source/api_reference/average.rst | 2 - source/api_reference/backward.rst | 2 - source/api_reference/clip.rst | 2 - source/api_reference/data | 1 - source/api_reference/data/data_reader.rst | 72 ++++++++++++++++ source/api_reference/data/dataset.rst | 82 +++++++++++++++++++ source/api_reference/data/image.rst | 5 ++ source/api_reference/data_feeder.rst | 2 - source/api_reference/executor.rst | 2 - source/api_reference/fluid.rst | 2 - source/api_reference/gen_doc.py | 10 +-- .../api_reference/{index.rst => index_en.rst} | 0 source/api_reference/initializer.rst | 2 - source/api_reference/io.rst | 2 - source/api_reference/layers.rst | 2 - source/api_reference/metrics.rst | 2 - source/api_reference/nets.rst | 2 - source/api_reference/optimizer.rst | 2 - source/api_reference/param_attr.rst | 2 - source/api_reference/profiler.rst | 2 - source/api_reference/recordio_writer.rst | 2 - source/api_reference/regularizer.rst | 2 - source/api_reference/transpiler.rst | 11 ++- 24 files changed, 197 insertions(+), 41 deletions(-) create mode 100644 source/api_reference/CMakeLists.txt delete mode 120000 source/api_reference/data create mode 100644 source/api_reference/data/data_reader.rst create mode 100644 source/api_reference/data/dataset.rst create mode 100644 source/api_reference/data/image.rst rename source/api_reference/{index.rst => index_en.rst} (100%) diff --git a/source/api_reference/CMakeLists.txt b/source/api_reference/CMakeLists.txt new file mode 100644 index 000000000..435d6e10f --- /dev/null +++ b/source/api_reference/CMakeLists.txt @@ -0,0 +1,25 @@ +# configured documentation tools and intermediate build results +set(BINARY_BUILD_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_build") + +# Sphinx cache with pickled ReST documents +set(SPHINX_CACHE_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/_doctrees") + +# HTML output director +set(SPHINX_HTML_DIR_EN "${CMAKE_CURRENT_BINARY_DIR}/en/html") + +set(IMPORT_PADDLE_STRING "import paddle") +set(IMPORT_PADDLEV2_STRING "import paddle.v2") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/../../templates/conf.py.en.in" + "${BINARY_BUILD_DIR_EN}/conf.py" + @ONLY) + +sphinx_add_target(paddle_fluid_apis + html + ${BINARY_BUILD_DIR_EN} + ${SPHINX_CACHE_DIR_EN} + ${CMAKE_CURRENT_SOURCE_DIR} + ${SPHINX_HTML_DIR_EN}) + +add_dependencies(paddle_fluid_apis gen_proto_py framework_py_proto copy_paddle_pybind paddle_python) diff --git a/source/api_reference/average.rst b/source/api_reference/average.rst index 48f208301..496f5b298 100644 --- a/source/api_reference/average.rst +++ b/source/api_reference/average.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_average: - ============= fluid.average ============= diff --git a/source/api_reference/backward.rst b/source/api_reference/backward.rst index 037e96d0c..115e0d24b 100644 --- a/source/api_reference/backward.rst +++ b/source/api_reference/backward.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_backward: - ============== fluid.backward ============== diff --git a/source/api_reference/clip.rst b/source/api_reference/clip.rst index 8d5b531db..aeefbb95a 100644 --- a/source/api_reference/clip.rst +++ b/source/api_reference/clip.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_clip: - ========== fluid.clip ========== diff --git a/source/api_reference/data b/source/api_reference/data deleted file mode 120000 index 5aa0dd5cb..000000000 --- a/source/api_reference/data +++ /dev/null @@ -1 +0,0 @@ -../../paddle/doc/fluid/api/data \ No newline at end of file diff --git a/source/api_reference/data/data_reader.rst b/source/api_reference/data/data_reader.rst new file mode 100644 index 000000000..1a35d0bbc --- /dev/null +++ b/source/api_reference/data/data_reader.rst @@ -0,0 +1,72 @@ +===================== +Data Reader Interface +===================== + + +DataTypes +========= + +.. autofunction:: paddle.v2.data_type.dense_array + :noindex: + +.. autofunction:: paddle.v2.data_type.integer_value + :noindex: + +.. autofunction:: paddle.v2.data_type.integer_value_sequence + :noindex: + +.. autofunction:: paddle.v2.data_type.integer_value_sub_sequence + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_binary_vector + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_binary_vector_sequence + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_binary_vector_sub_sequence + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_float_vector + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_float_vector_sequence + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_float_vector_sub_sequence + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_non_value_slot + :noindex: + +.. autofunction:: paddle.v2.data_type.sparse_value_slot + :noindex: + +.. autoclass:: paddle.v2.data_type.InputType + :members: + :noindex: + +DataFeeder +========== + +.. automodule:: paddle.v2.data_feeder + :members: + :noindex: + +Reader +====== + +.. automodule:: paddle.reader + :members: + :noindex: + +.. automodule:: paddle.reader.creator + :members: + :noindex: + +minibatch +========= + +.. automodule:: paddle.v2.minibatch + :members: + :noindex: diff --git a/source/api_reference/data/dataset.rst b/source/api_reference/data/dataset.rst new file mode 100644 index 000000000..e7c8be445 --- /dev/null +++ b/source/api_reference/data/dataset.rst @@ -0,0 +1,82 @@ +Dataset +======= + +.. automodule:: paddle.dataset + :members: + :noindex: + +mnist ++++++ + +.. automodule:: paddle.dataset.mnist + :members: + :noindex: + +cifar ++++++ + +.. automodule:: paddle.dataset.cifar + :members: + :noindex: + +conll05 ++++++++ + +.. automodule:: paddle.dataset.conll05 + :members: get_dict,get_embedding,test + :noindex: + +imdb +++++ + +.. automodule:: paddle.dataset.imdb + :members: + :noindex: + +imikolov +++++++++ + +.. automodule:: paddle.dataset.imikolov + :members: + :noindex: + +movielens ++++++++++ + +.. automodule:: paddle.dataset.movielens + :members: + :noindex: + +.. autoclass:: paddle.dataset.movielens.MovieInfo + :noindex: + +.. autoclass:: paddle.dataset.movielens.UserInfo + :noindex: + +sentiment ++++++++++ + +.. automodule:: paddle.dataset.sentiment + :members: + :noindex: + +uci_housing ++++++++++++ + +.. automodule:: paddle.dataset.uci_housing + :members: + :noindex: + +wmt14 ++++++ + +.. automodule:: paddle.dataset.wmt14 + :members: + :noindex: + +wmt16 ++++++ + +.. automodule:: paddle.dataset.wmt16 + :members: + :noindex: diff --git a/source/api_reference/data/image.rst b/source/api_reference/data/image.rst new file mode 100644 index 000000000..97651ffa6 --- /dev/null +++ b/source/api_reference/data/image.rst @@ -0,0 +1,5 @@ +Image Interface +=============== + +.. automodule:: paddle.v2.image + :members: diff --git a/source/api_reference/data_feeder.rst b/source/api_reference/data_feeder.rst index aed1bad8c..11d2890f5 100644 --- a/source/api_reference/data_feeder.rst +++ b/source/api_reference/data_feeder.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_data_feeder: - ================= fluid.data_feeder ================= diff --git a/source/api_reference/executor.rst b/source/api_reference/executor.rst index 0345e5b29..db2842e7f 100644 --- a/source/api_reference/executor.rst +++ b/source/api_reference/executor.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_executor: - ============== fluid.executor ============== diff --git a/source/api_reference/fluid.rst b/source/api_reference/fluid.rst index 4b330fdeb..51cdfe0c2 100644 --- a/source/api_reference/fluid.rst +++ b/source/api_reference/fluid.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid: - ===== fluid ===== diff --git a/source/api_reference/gen_doc.py b/source/api_reference/gen_doc.py index 011480a4a..02efce2bf 100644 --- a/source/api_reference/gen_doc.py +++ b/source/api_reference/gen_doc.py @@ -48,7 +48,7 @@ class DocGenerator(object): !DO NOT EDIT THIS FILE MANUALLY! ''') - self._print_ref_raw_("_".join(self.module_name.split("."))) + self._print_header_(self.module_name, dot='=', is_title=True) def print_submodule(self, submodule_name): @@ -70,7 +70,7 @@ class DocGenerator(object): def print_item(self, name): item = getattr(self.module, name, None) if item is None: - return + return if isinstance(item, types.TypeType): self.print_class(name) elif isinstance(item, types.FunctionType): @@ -107,10 +107,8 @@ class DocGenerator(object): self.stream.write('\n') def _print_ref_(self, name): - self._print_ref_raw_("_".join(self.module_name.split(".") + [name])) - - def _print_ref_raw_(self, anchor): - self.stream.write(".. _api_{0}:\n\n".format(anchor)) + self.stream.write(".. _api_{0}_{1}:\n\n".format("_".join( + self.module_name.split(".")), name)) def main(): diff --git a/source/api_reference/index.rst b/source/api_reference/index_en.rst similarity index 100% rename from source/api_reference/index.rst rename to source/api_reference/index_en.rst diff --git a/source/api_reference/initializer.rst b/source/api_reference/initializer.rst index f3fc2f2a6..dc0b52b14 100644 --- a/source/api_reference/initializer.rst +++ b/source/api_reference/initializer.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_initializer: - ================= fluid.initializer ================= diff --git a/source/api_reference/io.rst b/source/api_reference/io.rst index f89115537..7cee0bc4d 100644 --- a/source/api_reference/io.rst +++ b/source/api_reference/io.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_io: - ======== fluid.io ======== diff --git a/source/api_reference/layers.rst b/source/api_reference/layers.rst index 743f97c3e..264506a68 100644 --- a/source/api_reference/layers.rst +++ b/source/api_reference/layers.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_layers: - ============ fluid.layers ============ diff --git a/source/api_reference/metrics.rst b/source/api_reference/metrics.rst index 5ac2416bc..0f54b2e2e 100644 --- a/source/api_reference/metrics.rst +++ b/source/api_reference/metrics.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_metrics: - ============= fluid.metrics ============= diff --git a/source/api_reference/nets.rst b/source/api_reference/nets.rst index 8872f9da3..059733af1 100644 --- a/source/api_reference/nets.rst +++ b/source/api_reference/nets.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_nets: - ========== fluid.nets ========== diff --git a/source/api_reference/optimizer.rst b/source/api_reference/optimizer.rst index 234ce23b7..8d792120f 100644 --- a/source/api_reference/optimizer.rst +++ b/source/api_reference/optimizer.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_optimizer: - =============== fluid.optimizer =============== diff --git a/source/api_reference/param_attr.rst b/source/api_reference/param_attr.rst index 25a030fe9..33035bbc7 100644 --- a/source/api_reference/param_attr.rst +++ b/source/api_reference/param_attr.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_param_attr: - ================ fluid.param_attr ================ diff --git a/source/api_reference/profiler.rst b/source/api_reference/profiler.rst index 30e2a4f43..c750a2d58 100644 --- a/source/api_reference/profiler.rst +++ b/source/api_reference/profiler.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_profiler: - ============== fluid.profiler ============== diff --git a/source/api_reference/recordio_writer.rst b/source/api_reference/recordio_writer.rst index 32440b349..f0c12fd11 100644 --- a/source/api_reference/recordio_writer.rst +++ b/source/api_reference/recordio_writer.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_recordio_writer: - ===================== fluid.recordio_writer ===================== diff --git a/source/api_reference/regularizer.rst b/source/api_reference/regularizer.rst index 6bdfbe6dc..987eaea90 100644 --- a/source/api_reference/regularizer.rst +++ b/source/api_reference/regularizer.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_regularizer: - ================= fluid.regularizer ================= diff --git a/source/api_reference/transpiler.rst b/source/api_reference/transpiler.rst index 9c9b3dec9..d2ac04f14 100644 --- a/source/api_reference/transpiler.rst +++ b/source/api_reference/transpiler.rst @@ -1,8 +1,6 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_fluid_transpiler: - ================ fluid.transpiler ================ @@ -16,6 +14,15 @@ DistributeTranspiler :members: :noindex: +.. _api_fluid_transpiler_InferenceTranspiler: + +InferenceTranspiler +------------------- + +.. autoclass:: paddle.fluid.transpiler.InferenceTranspiler + :members: + :noindex: + .. _api_fluid_transpiler_memory_optimize: memory_optimize -- GitLab