提交 f01477b1 编写于 作者: Z Zeng Jinle 提交者: Cheerego

split layers,test=develop (#889)

上级 010917bb
Image Interface
===============
.. automodule:: paddle.image
:members:
......@@ -24,14 +24,20 @@ def parse_arg():
parser = argparse.ArgumentParser()
parser.add_argument('--submodules', nargs="*")
parser.add_argument(
'module', type=str, help='Generate the documentation of which module')
'--module', type=str, help='Generate the documentation of which module')
parser.add_argument(
'--module_prefix', type=str, help='Generate the prefix of module')
return parser.parse_args()
class DocGenerator(object):
def __init__(self, module_name=None, stream=sys.stdout):
def __init__(self, module_name=None, module_prefix=None, stream=sys.stdout):
if module_name == "":
module_name = None
if module_prefix == "":
module_prefix = None
self.stream = stream
if module_name is None:
self.module_name = "fluid"
......@@ -39,17 +45,34 @@ class DocGenerator(object):
self.module_name = "fluid." + module_name
if module_name is None:
self.module = fluid
else:
self.module = fluid
for each_module_name in module_name.split('.'):
if not hasattr(self.module, each_module_name):
raise ValueError("Cannot find fluid.{0}".format(module_name))
else:
self.module = getattr(self.module, each_module_name)
if module_prefix is None:
self.module_prefix = self.module_name
else:
if not hasattr(fluid, module_name):
raise ValueError("Cannot find fluid.{0}".format(module_name))
else:
self.module = getattr(fluid, module_name)
self.module_prefix = "fluid." + module_prefix
self.stream.write('''.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
''')
''')
self._print_header_(self.module_name, dot='=', is_title=True)
header_name = self.module_name
if module_prefix is not None:
prefix_len = len(self.module_prefix)
assert self.module_prefix == self.module_name[0:prefix_len], \
"module_prefix must be prefix of module_name"
diff_name = self.module_name[prefix_len+1:]
if diff_name != "":
header_name = diff_name
self._print_header_(header_name, dot='=', is_title=True)
def print_submodule(self, submodule_name):
submodule = getattr(self.module, submodule_name)
......@@ -85,7 +108,7 @@ class DocGenerator(object):
:members:
:noindex:
'''.format(self.module_name, name))
'''.format(self.module_prefix, name))
def print_method(self, name):
self._print_ref_(name)
......@@ -93,7 +116,7 @@ class DocGenerator(object):
self.stream.write('''.. autofunction:: paddle.{0}.{1}
:noindex:
'''.format(self.module_name, name))
'''.format(self.module_prefix, name))
def _print_header_(self, name, dot, is_title):
dot_line = dot * len(name)
......@@ -108,12 +131,12 @@ class DocGenerator(object):
def _print_ref_(self, name):
self.stream.write(".. _api_{0}_{1}:\n\n".format("_".join(
self.module_name.split(".")), name))
self.module_prefix.split(".")), name))
def main():
args = parse_arg()
gen = DocGenerator(args.module)
gen = DocGenerator(args.module, args.module_prefix)
if args.submodules is None:
gen.print_current_module()
else:
......
#!/bin/bash
python gen_doc.py layers --submodules control_flow device io nn ops tensor learning_rate_scheduler detection metric_op > layers.rst
mkdir -p layers
for module in control_flow io nn ops tensor learning_rate_scheduler detection metric_op
do
python gen_doc.py --module layers.${module} --module_prefix layers > layers/${module}.rst
done
for module in data_feeder dataset clip metrics executor initializer io nets optimizer profiler regularizer transpiler recordio_writer backward average profiler unique_name
do
python gen_doc.py ${module} > ${module}.rst
python gen_doc.py --module ${module} --module_prefix ${module} > ${module}.rst
done
python gen_doc.py "" > fluid.rst
python gen_doc.py --module "" --module_prefix "" > fluid.rst
python gen_index.py
......@@ -2,10 +2,11 @@ import os.path, time
import exceptions
import glob
import os
if __name__ == '__main__':
file_object = open('index_en.rst', 'w')
file_object.write('''=============
with open('index_en.rst', 'w') as file_object:
file_object = open('index_en.rst', 'w')
file_object.write('''=============
API Reference
=============
......@@ -13,9 +14,19 @@ API Reference
:maxdepth: 1
''')
file_object.write(' ../api_guides/index_en.rst'+'\n')
file_object.write(' fluid.rst'+'\n')
for file_name in sorted(glob.glob("*.rst")):
if file_name != ('index_en.rst' and 'fluid.rst'):
file_object.write(' '+file_name + "\n")
file_object.close( )
file_object.write(' ../api_guides/index_en.rst'+'\n')
file_object.write(' fluid.rst'+'\n')
target_dirs = ['.', 'data']
file_names = []
for target_dir in target_dirs:
if target_dir == '.':
pattern = '*.rst'
else:
pattern = target_dir + '/*.rst'
file_names.extend(glob.glob(pattern))
for file_name in sorted(file_names):
if file_name not in ['index_en.rst', 'fluid.rst']:
file_object.write(' '+file_name + "\n")
......@@ -10,7 +10,8 @@ API Reference
average.rst
backward.rst
clip.rst
data.rst
data/data_reader.rst
data/dataset.rst
data_feeder.rst
dataset.rst
executor.rst
......@@ -25,6 +26,3 @@ API Reference
regularizer.rst
transpiler.rst
unique_name.rst
data/dataset.rst
data/data_reader.rst
此差异已折叠。
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
============
control_flow
============
.. _api_fluid_layers_array_length:
array_length
------------
.. autofunction:: paddle.fluid.layers.array_length
:noindex:
.. _api_fluid_layers_array_read:
array_read
----------
.. autofunction:: paddle.fluid.layers.array_read
:noindex:
.. _api_fluid_layers_array_write:
array_write
-----------
.. autofunction:: paddle.fluid.layers.array_write
:noindex:
.. _api_fluid_layers_create_array:
create_array
------------
.. autofunction:: paddle.fluid.layers.create_array
:noindex:
.. _api_fluid_layers_DynamicRNN:
DynamicRNN
----------
.. autoclass:: paddle.fluid.layers.DynamicRNN
:members:
:noindex:
.. _api_fluid_layers_equal:
equal
-----
.. autofunction:: paddle.fluid.layers.equal
:noindex:
.. _api_fluid_layers_greater_equal:
greater_equal
-------------
.. autofunction:: paddle.fluid.layers.greater_equal
:noindex:
.. _api_fluid_layers_greater_than:
greater_than
------------
.. autofunction:: paddle.fluid.layers.greater_than
:noindex:
.. _api_fluid_layers_IfElse:
IfElse
------
.. autoclass:: paddle.fluid.layers.IfElse
:members:
:noindex:
.. _api_fluid_layers_increment:
increment
---------
.. autofunction:: paddle.fluid.layers.increment
:noindex:
.. _api_fluid_layers_is_empty:
is_empty
--------
.. autofunction:: paddle.fluid.layers.is_empty
:noindex:
.. _api_fluid_layers_less_equal:
less_equal
----------
.. autofunction:: paddle.fluid.layers.less_equal
:noindex:
.. _api_fluid_layers_less_than:
less_than
---------
.. autofunction:: paddle.fluid.layers.less_than
:noindex:
.. _api_fluid_layers_not_equal:
not_equal
---------
.. autofunction:: paddle.fluid.layers.not_equal
:noindex:
.. _api_fluid_layers_Print:
Print
-----
.. autofunction:: paddle.fluid.layers.Print
:noindex:
.. _api_fluid_layers_reorder_lod_tensor_by_rank:
reorder_lod_tensor_by_rank
--------------------------
.. autofunction:: paddle.fluid.layers.reorder_lod_tensor_by_rank
:noindex:
.. _api_fluid_layers_StaticRNN:
StaticRNN
---------
.. autoclass:: paddle.fluid.layers.StaticRNN
:members:
:noindex:
.. _api_fluid_layers_Switch:
Switch
------
.. autoclass:: paddle.fluid.layers.Switch
:members:
:noindex:
.. _api_fluid_layers_While:
While
-----
.. autoclass:: paddle.fluid.layers.While
:members:
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
=========
detection
=========
.. _api_fluid_layers_anchor_generator:
anchor_generator
----------------
.. autofunction:: paddle.fluid.layers.anchor_generator
:noindex:
.. _api_fluid_layers_bipartite_match:
bipartite_match
---------------
.. autofunction:: paddle.fluid.layers.bipartite_match
:noindex:
.. _api_fluid_layers_box_clip:
box_clip
--------
.. autofunction:: paddle.fluid.layers.box_clip
:noindex:
.. _api_fluid_layers_box_coder:
box_coder
---------
.. autofunction:: paddle.fluid.layers.box_coder
:noindex:
.. _api_fluid_layers_box_decoder_and_assign:
box_decoder_and_assign
----------------------
.. autofunction:: paddle.fluid.layers.box_decoder_and_assign
:noindex:
.. _api_fluid_layers_collect_fpn_proposals:
collect_fpn_proposals
---------------------
.. autofunction:: paddle.fluid.layers.collect_fpn_proposals
:noindex:
.. _api_fluid_layers_density_prior_box:
density_prior_box
-----------------
.. autofunction:: paddle.fluid.layers.density_prior_box
:noindex:
.. _api_fluid_layers_detection_map:
detection_map
-------------
.. autofunction:: paddle.fluid.layers.detection_map
:noindex:
.. _api_fluid_layers_detection_output:
detection_output
----------------
.. autofunction:: paddle.fluid.layers.detection_output
:noindex:
.. _api_fluid_layers_distribute_fpn_proposals:
distribute_fpn_proposals
------------------------
.. autofunction:: paddle.fluid.layers.distribute_fpn_proposals
:noindex:
.. _api_fluid_layers_generate_mask_labels:
generate_mask_labels
--------------------
.. autofunction:: paddle.fluid.layers.generate_mask_labels
:noindex:
.. _api_fluid_layers_generate_proposal_labels:
generate_proposal_labels
------------------------
.. autofunction:: paddle.fluid.layers.generate_proposal_labels
:noindex:
.. _api_fluid_layers_generate_proposals:
generate_proposals
------------------
.. autofunction:: paddle.fluid.layers.generate_proposals
:noindex:
.. _api_fluid_layers_iou_similarity:
iou_similarity
--------------
.. autofunction:: paddle.fluid.layers.iou_similarity
:noindex:
.. _api_fluid_layers_multi_box_head:
multi_box_head
--------------
.. autofunction:: paddle.fluid.layers.multi_box_head
:noindex:
.. _api_fluid_layers_multiclass_nms:
multiclass_nms
--------------
.. autofunction:: paddle.fluid.layers.multiclass_nms
:noindex:
.. _api_fluid_layers_polygon_box_transform:
polygon_box_transform
---------------------
.. autofunction:: paddle.fluid.layers.polygon_box_transform
:noindex:
.. _api_fluid_layers_prior_box:
prior_box
---------
.. autofunction:: paddle.fluid.layers.prior_box
:noindex:
.. _api_fluid_layers_roi_perspective_transform:
roi_perspective_transform
-------------------------
.. autofunction:: paddle.fluid.layers.roi_perspective_transform
:noindex:
.. _api_fluid_layers_rpn_target_assign:
rpn_target_assign
-----------------
.. autofunction:: paddle.fluid.layers.rpn_target_assign
:noindex:
.. _api_fluid_layers_ssd_loss:
ssd_loss
--------
.. autofunction:: paddle.fluid.layers.ssd_loss
:noindex:
.. _api_fluid_layers_target_assign:
target_assign
-------------
.. autofunction:: paddle.fluid.layers.target_assign
:noindex:
.. _api_fluid_layers_yolo_box:
yolo_box
--------
.. autofunction:: paddle.fluid.layers.yolo_box
:noindex:
.. _api_fluid_layers_yolov3_loss:
yolov3_loss
-----------
.. autofunction:: paddle.fluid.layers.yolov3_loss
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
==
io
==
.. _api_fluid_layers_batch:
batch
-----
.. autofunction:: paddle.fluid.layers.batch
:noindex:
.. _api_fluid_layers_create_py_reader_by_data:
create_py_reader_by_data
------------------------
.. autofunction:: paddle.fluid.layers.create_py_reader_by_data
:noindex:
.. _api_fluid_layers_data:
data
----
.. autofunction:: paddle.fluid.layers.data
:noindex:
.. _api_fluid_layers_double_buffer:
double_buffer
-------------
.. autofunction:: paddle.fluid.layers.double_buffer
:noindex:
.. _api_fluid_layers_load:
load
----
.. autofunction:: paddle.fluid.layers.load
:noindex:
.. _api_fluid_layers_open_files:
open_files
----------
.. autofunction:: paddle.fluid.layers.open_files
:noindex:
.. _api_fluid_layers_Preprocessor:
Preprocessor
------------
.. autoclass:: paddle.fluid.layers.Preprocessor
:members:
:noindex:
.. _api_fluid_layers_py_reader:
py_reader
---------
.. autofunction:: paddle.fluid.layers.py_reader
:noindex:
.. _api_fluid_layers_random_data_generator:
random_data_generator
---------------------
.. autofunction:: paddle.fluid.layers.random_data_generator
:noindex:
.. _api_fluid_layers_read_file:
read_file
---------
.. autofunction:: paddle.fluid.layers.read_file
:noindex:
.. _api_fluid_layers_shuffle:
shuffle
-------
.. autofunction:: paddle.fluid.layers.shuffle
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
=======================
learning_rate_scheduler
=======================
.. _api_fluid_layers_cosine_decay:
cosine_decay
------------
.. autofunction:: paddle.fluid.layers.cosine_decay
:noindex:
.. _api_fluid_layers_exponential_decay:
exponential_decay
-----------------
.. autofunction:: paddle.fluid.layers.exponential_decay
:noindex:
.. _api_fluid_layers_inverse_time_decay:
inverse_time_decay
------------------
.. autofunction:: paddle.fluid.layers.inverse_time_decay
:noindex:
.. _api_fluid_layers_linear_lr_warmup:
linear_lr_warmup
----------------
.. autofunction:: paddle.fluid.layers.linear_lr_warmup
:noindex:
.. _api_fluid_layers_natural_exp_decay:
natural_exp_decay
-----------------
.. autofunction:: paddle.fluid.layers.natural_exp_decay
:noindex:
.. _api_fluid_layers_noam_decay:
noam_decay
----------
.. autofunction:: paddle.fluid.layers.noam_decay
:noindex:
.. _api_fluid_layers_piecewise_decay:
piecewise_decay
---------------
.. autofunction:: paddle.fluid.layers.piecewise_decay
:noindex:
.. _api_fluid_layers_polynomial_decay:
polynomial_decay
----------------
.. autofunction:: paddle.fluid.layers.polynomial_decay
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
=========
metric_op
=========
.. _api_fluid_layers_accuracy:
accuracy
--------
.. autofunction:: paddle.fluid.layers.accuracy
:noindex:
.. _api_fluid_layers_auc:
auc
---
.. autofunction:: paddle.fluid.layers.auc
:noindex:
此差异已折叠。
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
===
ops
===
.. _api_fluid_layers_abs:
abs
---
.. autofunction:: paddle.fluid.layers.abs
:noindex:
.. _api_fluid_layers_acos:
acos
----
.. autofunction:: paddle.fluid.layers.acos
:noindex:
.. _api_fluid_layers_asin:
asin
----
.. autofunction:: paddle.fluid.layers.asin
:noindex:
.. _api_fluid_layers_atan:
atan
----
.. autofunction:: paddle.fluid.layers.atan
:noindex:
.. _api_fluid_layers_ceil:
ceil
----
.. autofunction:: paddle.fluid.layers.ceil
:noindex:
.. _api_fluid_layers_cos:
cos
---
.. autofunction:: paddle.fluid.layers.cos
:noindex:
.. _api_fluid_layers_cumsum:
cumsum
------
.. autofunction:: paddle.fluid.layers.cumsum
:noindex:
.. _api_fluid_layers_exp:
exp
---
.. autofunction:: paddle.fluid.layers.exp
:noindex:
.. _api_fluid_layers_floor:
floor
-----
.. autofunction:: paddle.fluid.layers.floor
:noindex:
.. _api_fluid_layers_hard_shrink:
hard_shrink
-----------
.. autofunction:: paddle.fluid.layers.hard_shrink
:noindex:
.. _api_fluid_layers_logsigmoid:
logsigmoid
----------
.. autofunction:: paddle.fluid.layers.logsigmoid
:noindex:
.. _api_fluid_layers_reciprocal:
reciprocal
----------
.. autofunction:: paddle.fluid.layers.reciprocal
:noindex:
.. _api_fluid_layers_round:
round
-----
.. autofunction:: paddle.fluid.layers.round
:noindex:
.. _api_fluid_layers_rsqrt:
rsqrt
-----
.. autofunction:: paddle.fluid.layers.rsqrt
:noindex:
.. _api_fluid_layers_sigmoid:
sigmoid
-------
.. autofunction:: paddle.fluid.layers.sigmoid
:noindex:
.. _api_fluid_layers_sin:
sin
---
.. autofunction:: paddle.fluid.layers.sin
:noindex:
.. _api_fluid_layers_softplus:
softplus
--------
.. autofunction:: paddle.fluid.layers.softplus
:noindex:
.. _api_fluid_layers_softshrink:
softshrink
----------
.. autofunction:: paddle.fluid.layers.softshrink
:noindex:
.. _api_fluid_layers_softsign:
softsign
--------
.. autofunction:: paddle.fluid.layers.softsign
:noindex:
.. _api_fluid_layers_sqrt:
sqrt
----
.. autofunction:: paddle.fluid.layers.sqrt
:noindex:
.. _api_fluid_layers_square:
square
------
.. autofunction:: paddle.fluid.layers.square
:noindex:
.. _api_fluid_layers_tanh:
tanh
----
.. autofunction:: paddle.fluid.layers.tanh
:noindex:
.. _api_fluid_layers_tanh_shrink:
tanh_shrink
-----------
.. autofunction:: paddle.fluid.layers.tanh_shrink
:noindex:
.. _api_fluid_layers_thresholded_relu:
thresholded_relu
----------------
.. autofunction:: paddle.fluid.layers.thresholded_relu
:noindex:
.. _api_fluid_layers_uniform_random:
uniform_random
--------------
.. autofunction:: paddle.fluid.layers.uniform_random
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
======
tensor
======
.. _api_fluid_layers_argmax:
argmax
------
.. autofunction:: paddle.fluid.layers.argmax
:noindex:
.. _api_fluid_layers_argmin:
argmin
------
.. autofunction:: paddle.fluid.layers.argmin
:noindex:
.. _api_fluid_layers_argsort:
argsort
-------
.. autofunction:: paddle.fluid.layers.argsort
:noindex:
.. _api_fluid_layers_assign:
assign
------
.. autofunction:: paddle.fluid.layers.assign
:noindex:
.. _api_fluid_layers_cast:
cast
----
.. autofunction:: paddle.fluid.layers.cast
:noindex:
.. _api_fluid_layers_concat:
concat
------
.. autofunction:: paddle.fluid.layers.concat
:noindex:
.. _api_fluid_layers_create_global_var:
create_global_var
-----------------
.. autofunction:: paddle.fluid.layers.create_global_var
:noindex:
.. _api_fluid_layers_create_parameter:
create_parameter
----------------
.. autofunction:: paddle.fluid.layers.create_parameter
:noindex:
.. _api_fluid_layers_create_tensor:
create_tensor
-------------
.. autofunction:: paddle.fluid.layers.create_tensor
:noindex:
.. _api_fluid_layers_diag:
diag
----
.. autofunction:: paddle.fluid.layers.diag
:noindex:
.. _api_fluid_layers_fill_constant:
fill_constant
-------------
.. autofunction:: paddle.fluid.layers.fill_constant
:noindex:
.. _api_fluid_layers_fill_constant_batch_size_like:
fill_constant_batch_size_like
-----------------------------
.. autofunction:: paddle.fluid.layers.fill_constant_batch_size_like
:noindex:
.. _api_fluid_layers_has_inf:
has_inf
-------
.. autofunction:: paddle.fluid.layers.has_inf
:noindex:
.. _api_fluid_layers_has_nan:
has_nan
-------
.. autofunction:: paddle.fluid.layers.has_nan
:noindex:
.. _api_fluid_layers_isfinite:
isfinite
--------
.. autofunction:: paddle.fluid.layers.isfinite
:noindex:
.. _api_fluid_layers_linspace:
linspace
--------
.. autofunction:: paddle.fluid.layers.linspace
:noindex:
.. _api_fluid_layers_ones:
ones
----
.. autofunction:: paddle.fluid.layers.ones
:noindex:
.. _api_fluid_layers_range:
range
-----
.. autofunction:: paddle.fluid.layers.range
:noindex:
.. _api_fluid_layers_reverse:
reverse
-------
.. autofunction:: paddle.fluid.layers.reverse
:noindex:
.. _api_fluid_layers_sums:
sums
----
.. autofunction:: paddle.fluid.layers.sums
:noindex:
.. _api_fluid_layers_tensor_array_to_tensor:
tensor_array_to_tensor
----------------------
.. autofunction:: paddle.fluid.layers.tensor_array_to_tensor
:noindex:
.. _api_fluid_layers_zeros:
zeros
-----
.. autofunction:: paddle.fluid.layers.zeros
:noindex:
.. _api_fluid_layers_zeros_like:
zeros_like
----------
.. autofunction:: paddle.fluid.layers.zeros_like
:noindex:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册