提交 3789dbca 编写于 作者: L LI Yunxiang

add code autodoc

上级 96c58265
// modified from
// https://github.com/tensorpack/tensorpack/blob/master/docs/_static/build_toc_group.js
$(function (){
var createList = function(selected) {
var obj = {};
var ul = $('<ul>');
selected.each(function(i,e) {
var groupName = $(e).find('a')[0].href;
groupName = groupName.substr(groupName.lastIndexOf('/')+1);
groupName = groupName.substr(0,groupName.lastIndexOf(".html"));
var fullname = e.id;
if (fullname.startsWith('parl.'))
fullname = fullname.substr(5);
if (fullname == "dataflow.MultiProcessMapData") {
groupName = "parallel_map";
}
var n = $(e).children('.descname').clone();
n[0].innerText = fullname;
var l = $(e).children('.headerlink');
var a = $('<a>');
a.attr('href', l.attr('href')).attr('title', 'Link to this definition');
a.append(n);
var entry = $('<li>').append(a);
if(groupName in obj) {
obj[groupName].append(entry);
} else {
var ul = $('<ul style="margin-bottom: 12px;">');
ul.append(entry);
obj[groupName] = ul;
}
});
return obj;
}
var customIndex = $('.custom-index');
customIndex.empty();
var selected = $('div.section>dl>dt');
if (selected.length === 0)
return;
var obj = createList(selected);
var block = $('<div style="min-width: 300px; margin-bottom: 2em;">');
for(var key in obj) {
var a = $('<h6 style="margin-bottom: 0;">');
a.html(key + ':');
block.append(a);
block.append(obj[key]);
}
customIndex.append(block);
});
{% extends "!layout.html" %}
{%- block extrahead %}
<script type="text/javascript"
src={{ pathto('_static/jquery-3.2.1.min.js', 1) }}>
</script>
<script type="text/javascript"
src={{ pathto('_static/sanitize_desc_name.js', 1) }}>
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42349716-2', 'auto');
ga('send', 'pageview');
</script>
{% endblock %}
Algorithms.a3c
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.a3c
:members:
:undoc-members:
:show-inheritance:
Algorithms.ddpg
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.ddpg
:members:
:undoc-members:
:show-inheritance:
Algorithms.dqn
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.dqn
:members:
:undoc-members:
:show-inheritance:
Algorithms.impala
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.impala.impala
:members:
:undoc-members:
:show-inheritance:
Algorithms.impala
=====================================
.. toctree::
:maxdepth: 1
impala
vtrace
\ No newline at end of file
Algorithms.vtrace
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.impala.vtrace
:members:
:undoc-members:
:show-inheritance:
PARL.Algorithms
=====================================
.. toctree::
:maxdepth: 2
impala/index
a3c
ddpg
dqn
policy_gradient
ppo
\ No newline at end of file
Algorithms.policy_gradient
----------------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.policy_gradient
:members:
:undoc-members:
:show-inheritance:
Algorithms.ppo
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.algorithms.ppo
:members:
:undoc-members:
:show-inheritance:
.. PARL_docs documentation master file, created by
sphinx-quickstart on Mon Apr 22 11:12:25 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
PARL Documentation
=====================================
.. toctree::
:maxdepth: 1
utils
...@@ -34,6 +34,9 @@ import sphinx_rtd_theme ...@@ -34,6 +34,9 @@ import sphinx_rtd_theme
import os import os
import sys import sys
import parl import parl
autodoc_mock_imports = ['paddle']
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
release = parl.__version__ release = parl.__version__
project = 'PARL' project = 'PARL'
copyright = '2019, nlp-ol@baidu.com' copyright = '2019, nlp-ol@baidu.com'
......
Framework.agent_base
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.framework.agent_base
:members:
:undoc-members:
:show-inheritance:
Framework.algorithm_base
---------------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.framework.algorithm_base
:members:
:undoc-members:
:show-inheritance:
PARL.Framework
=====================================
.. toctree::
:maxdepth: 1
agent_base
algorithm_base
model_base
policy_distri
parl.Model Framework.model_base
-------------------- --------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.framework.model_base .. automodule:: parl.framework.model_base
:members: :members:
:undoc-members: :undoc-members:
......
Framework.policy_distribution
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.framework.policy_distribution
:members:
:undoc-members:
:show-inheritance:
...@@ -68,11 +68,15 @@ Features ...@@ -68,11 +68,15 @@ Features
implementations.rst implementations.rst
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 3
:caption: APIs :caption: API
./api_docs.utils algo_docs/index
./api_docs.index framework_docs/index
layers_docs/index
plutils_docs/index
remote_docs/index
utils_docs/index
Abstractions Abstractions
---------------- ----------------
......
...@@ -9,4 +9,4 @@ Install ...@@ -9,4 +9,4 @@ Install
------------- -------------
PARL is distributed on PyPI and can be installed with pip: PARL is distributed on PyPI and can be installed with pip:
:: ::
pip install parl pip install parl
Layers.attr_docs
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.layers.attr_holder
:members:
:undoc-members:
:show-inheritance:
PARL.Layers
=====================================
.. toctree::
:maxdepth: 1
attr_holder
layer_wrappers
\ No newline at end of file
Layers.layer_wrappers
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.layers.layer_wrappers
:members:
:undoc-members:
:show-inheritance:
Plutils.common
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.plutils.common
:members:
:undoc-members:
:show-inheritance:
PARL.Plutils
=====================================
.. toctree::
:maxdepth: 1
common
\ No newline at end of file
Remote.exception
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.remote.exceptions
:members:
:undoc-members:
:show-inheritance:
PARL.Remote
=====================================
.. toctree::
:maxdepth: 1
exceptions
remote_constants
remote_decorator
remote_manager
remote_object
\ No newline at end of file
Remote.remote_constants
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.remote.remote_constants
:members:
:undoc-members:
:show-inheritance:
Remote.remote_decorator
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.remote.remote_decorator
:members:
:undoc-members:
:show-inheritance:
Remote.remote_manager
-----------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.remote.remote_manager
:members:
:undoc-members:
:show-inheritance:
Remote.remote_object
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.remote.remote_object
:members:
:undoc-members:
:show-inheritance:
Utils.Communication
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.communication
:members:
:undoc-members:
:show-inheritance:
Utils.Csv_logger
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.csv_logger
:members:
:undoc-members:
:show-inheritance:
Utils.Exceptions
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.exceptions
:members:
:undoc-members:
:show-inheritance:
PARL.Utils
=====================================
.. toctree::
:maxdepth: 1
communication
csv_logger
exceptions
logger
machine_info
np_utils
replay_memory
rl_utils
scheduler
time_stat
utils
window_stat
\ No newline at end of file
Utils.Logger
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.logger
:members:
:undoc-members:
:show-inheritance:
Utils.Machine_info
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.machine_info
:members:
:undoc-members:
:show-inheritance:
Utils.np_utils
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.np_utils
:members:
:undoc-members:
:show-inheritance:
Utils.Replay_memory
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.replay_memory
:members:
:undoc-members:
:show-inheritance:
Utils.RL_utils
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.rl_utils
:members:
:undoc-members:
:show-inheritance:
Utils.Scheduler
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.scheduler
:members:
:undoc-members:
:show-inheritance:
Utils.Time_stat
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.time_stat
:members:
:undoc-members:
:show-inheritance:
Utils.Utils
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.utils
:members:
:undoc-members:
:show-inheritance:
Utils.Window_stat
--------------------
.. container:: custom-index
.. raw:: html
<script type="text/javascript" src='../_static/build_toc_group.js'></script>
.. automodule:: parl.utils.window_stat
:members:
:undoc-members:
:show-inheritance:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册