未验证 提交 52b1c8f5 编写于 作者: T tianshuo78520a 提交者: GitHub

Add nn api (#2025)

* add nn.* api

* test=develop
上级 b48a0d3e
...@@ -83,7 +83,7 @@ class DocGenerator(object): ...@@ -83,7 +83,7 @@ class DocGenerator(object):
def print_section(self, name): def print_section(self, name):
self._print_header_(name, dot='=', is_title=False) self._print_header_(name, dot='=', is_title=False)
def print_item(self, name): def print_item(self, name, output_name):
item = getattr(self.module, name, None) item = getattr(self.module, name, None)
if isinstance(item, types.TypeType): if isinstance(item, types.TypeType):
self.print_class(name) self.print_class(name)
...@@ -91,7 +91,7 @@ class DocGenerator(object): ...@@ -91,7 +91,7 @@ class DocGenerator(object):
self.print_method(name) self.print_method(name)
else: else:
self.stream.close() self.stream.close()
path = os.getcwd()+"/fluid/"+name+".rst" path = os.getcwd()+"/"+output_name+"/"+name+".rst"
if name != "PipeReader": if name != "PipeReader":
os.remove(path) os.remove(path)
...@@ -208,7 +208,7 @@ def generate_doc(module_name, module_prefix, output, output_name, to_multiple_fi ...@@ -208,7 +208,7 @@ def generate_doc(module_name, module_prefix, output, output_name, to_multiple_fi
header_name = api header_name = api
with gen.guard(os.path.join(output, api + '.rst')): with gen.guard(os.path.join(output, api + '.rst')):
gen.print_header_reminder() gen.print_header_reminder()
gen.print_item(api) gen.print_item(api, output_name)
def main(): def main():
......
#!/bin/bash #!/bin/bash
# fluid
for module in layers dataset clip metrics executor initializer io nets optimizer profiler regularizer transpiler backward 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 do
python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name fluid --to_multiple_files True python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name fluid --to_multiple_files True
...@@ -9,6 +10,7 @@ done ...@@ -9,6 +10,7 @@ done
python gen_doc.py --module_name "" --module_prefix "" --output fluid --output_name fluid --to_multiple_files True python gen_doc.py --module_name "" --module_prefix "" --output fluid --output_name fluid --to_multiple_files True
python gen_module_index.py fluid fluid python gen_module_index.py fluid fluid
# tensor
for module in math random stat for module in math random stat
do do
python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name tensor --to_multiple_files True --output_dir tensor python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name tensor --to_multiple_files True --output_dir tensor
...@@ -17,14 +19,6 @@ done ...@@ -17,14 +19,6 @@ done
python gen_module_index.py tensor paddle.tensor python gen_module_index.py tensor paddle.tensor
for module in loss
do
python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name nn --to_multiple_files True --output_dir nn
python gen_module_index.py nn.${module} ${module}
done
python gen_module_index.py nn paddle.nn
for module in math manipulation for module in math manipulation
do do
python gen_doc.py --module_name tensor.${module} --module_prefix tensor.${module} --output tensor/${module} --output_name complex --to_multiple_files True --output_dir complex python gen_doc.py --module_name tensor.${module} --module_prefix tensor.${module} --output tensor/${module} --output_name complex --to_multiple_files True --output_dir complex
...@@ -34,5 +28,16 @@ done ...@@ -34,5 +28,16 @@ done
python gen_module_index.py complex.tensor tensor python gen_module_index.py complex.tensor tensor
python gen_module_index.py complex paddle.complex python gen_module_index.py complex paddle.complex
# nn
for module in loss
do
python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name nn --to_multiple_files True --output_dir nn
python gen_module_index.py nn.${module} ${module}
done
python gen_doc.py --module_name "" --module_prefix "" --output nn --output_name nn --to_multiple_files True
python gen_module_index.py nn paddle.nn
# index.rst
python gen_index.py python gen_index.py
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册