Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically generate API References #731

Merged
merged 8 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sphinx==4.1.0
pydata_sphinx_theme==0.6.3
myst-parser==0.15.1
sphinx==5.3.0
pydata_sphinx_theme==0.11.0
myst-parser==1.0.0

# TODO: #204
onnx
31 changes: 31 additions & 0 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:special-members: __init__, __call__
:undoc-members:
:show-inheritance:

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
68 changes: 68 additions & 0 deletions docs/source/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
:toctree: .

{% for item in attributes %}
{{ fullname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree: .

{% for item in functions %}
{{ fullname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree: .

{% for item in classes %}
{{ fullname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree: .

{% for item in exceptions %}
{{ fullname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree: .
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

# Autosummary
autosummary_generate = True
autosummary_imported_members = True
autoclass_content = "both"

# -- Options for HTML output -------------------------------------------------

Expand Down
29 changes: 10 additions & 19 deletions docs/source/reference/index.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
.. module:: pytorch_pfn_extras

API Reference
=============

* :ref:`genindex`

Package
-------
.. autosummary::
:toctree: generated/
:recursive:

pytorch_pfn_extras

.. currentmodule:: pytorch_pfn_extras

Training Loop
------------------

Trainer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autosummary::
:toctree: generated/

engine.create_trainer
engine.create_evaluator
Expand All @@ -28,7 +36,6 @@ Extensions Manager
~~~~~~~~~~~~~~~~~~

.. autosummary::
:toctree: generated/

training.ExtensionsManager
training.IgniteExtensionsManager
Expand All @@ -37,15 +44,13 @@ Extensions
~~~~~~~~~~

.. autosummary::
:toctree: generated/

training.extension.make_extension
training.extension.Extension
training.extension.ExtensionEntry


.. autosummary::
:toctree: generated/

training.extensions.BestValue
training.extensions.Evaluator
Expand All @@ -69,7 +74,6 @@ Triggers
~~~~~~~~

.. autosummary::
:toctree: generated/

training.triggers.EarlyStoppingTrigger
training.triggers.IntervalTrigger
Expand All @@ -85,7 +89,6 @@ Reporting
~~~~~~~~~

.. autosummary::
:toctree: generated/

reporting.Reporter
reporting.report
Expand All @@ -96,23 +99,20 @@ Logging
~~~~~~~

.. autosummary::
:toctree: generated/

logging.get_logger

Profiler
~~~~~~~~

.. autosummary::
:toctree: generated/

profiler.TimeSummary.report

Distributed Training
---------------------

.. autosummary::
:toctree: generated/

nn.parallel.DistributedDataParallel
distributed.initialize_ompi_environment
Expand All @@ -122,7 +122,6 @@ Check Pointing
---------------------

.. autosummary::
:toctree: generated/

utils.checkpoint

Expand All @@ -131,7 +130,6 @@ Lazy Modules
------------------

.. autosummary::
:toctree: generated/

nn.Ensure
nn.ensure
Expand All @@ -151,7 +149,6 @@ Export
~~~~~~~

.. autosummary::
:toctree: generated/

onnx.export
onnx.export_testcase
Expand All @@ -161,7 +158,6 @@ Annotation
~~~~~~~~~~~

.. autosummary::
:toctree: generated/

onnx.annotate
onnx.apply_annotation
Expand All @@ -174,7 +170,6 @@ Datasets
------------------------

.. autosummary::
:toctree: generated/

dataset.SharedDataset
dataset.TabularDataset
Expand All @@ -185,12 +180,10 @@ Config
------------------------

.. autosummary::
:toctree: generated/

config.Config

.. autosummary::
:toctree: generated/

config_types.optuna_types
config_types.load_path_with_optuna_types
Expand All @@ -200,7 +193,6 @@ NumPy/CuPy Compatibility
------------------------

.. autosummary::
:toctree: generated/

from_ndarray
as_ndarray
Expand All @@ -209,7 +201,6 @@ NumPy/CuPy Compatibility
from_numpy_dtype

.. autosummary::
:toctree: generated/

cuda.stream
cuda.use_torch_mempool_in_cupy
Expand Down
Loading