Skip to content

Commit

Permalink
renderer and vis readthedocs #1363
Browse files Browse the repository at this point in the history
Summary: Autogenerate docs for the renderer too. This will be helpful but make a slightly ugly TOC

Reviewed By: kjchalup

Differential Revision: D40977315

fbshipit-source-id: 10831de3ced68080cb5671c5dc31d4da8500f761
  • Loading branch information
bottler authored and facebook-github-bot committed Nov 15, 2022
1 parent d0fbe2c commit 9a0b0c2
Show file tree
Hide file tree
Showing 46 changed files with 408 additions and 99 deletions.
118 changes: 66 additions & 52 deletions docs/generate_implicitron_stubs.py → docs/generate_stubs.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from pathlib import Path

ROOT_DIR = Path(__file__).resolve().parent.parent
DEST_DIR = Path(__file__).resolve().parent / "modules/implicitron"


def paths_to_modules(paths):
Expand Down Expand Up @@ -95,54 +94,69 @@ def make_directory_index(title: str, directory_path: Path):
print(f" {rst.stem}", file=f)


iterate_directory(ROOT_DIR / "pytorch3d/implicitron/models", DEST_DIR / "models")

unwanted_tools = ["configurable", "depth_cleanup", "utils"]
tools_sources = sorted(ROOT_DIR.glob("pytorch3d/implicitron/tools/*.py"))
tools_modules = [
str(i.relative_to(ROOT_DIR))[:-3].replace("/", ".")
for i in tools_sources
if i.stem not in unwanted_tools
]
create_one_file(
"pytorch3d.implicitron.tools",
"Tools for implicitron",
tools_modules,
DEST_DIR / "tools.rst",
)

dataset_files = sorted(ROOT_DIR.glob("pytorch3d/implicitron/dataset/*.py"))
basic_dataset = [
"dataset_base",
"dataset_map_provider",
"data_loader_map_provider",
"data_source",
"scene_batch_sampler",
]
basic_dataset_modules = [f"pytorch3d.implicitron.dataset.{i}" for i in basic_dataset]
create_one_file(
"pytorch3d.implicitron.dataset in general",
"Basics of data for implicitron",
basic_dataset_modules,
DEST_DIR / "data_basics.rst",
)

specific_dataset_files = [
i for i in dataset_files if i.stem.find("_dataset_map_provider") != -1
]
create_one_file(
"pytorch3d.implicitron.dataset specific datasets",
"specific datasets",
paths_to_modules(specific_dataset_files),
DEST_DIR / "datasets.rst",
)

evaluation_files = sorted(ROOT_DIR.glob("pytorch3d/implicitron/evaluation/*.py"))
create_one_file(
"pytorch3d.implicitron.evaluation",
"evaluation",
paths_to_modules(evaluation_files),
DEST_DIR / "evaluation.rst",
)

make_directory_index("pytorch3d.implicitron", DEST_DIR)
def do_implicitron():
DEST_DIR = Path(__file__).resolve().parent / "modules/implicitron"

iterate_directory(ROOT_DIR / "pytorch3d/implicitron/models", DEST_DIR / "models")

unwanted_tools = ["configurable", "depth_cleanup", "utils"]
tools_sources = sorted(ROOT_DIR.glob("pytorch3d/implicitron/tools/*.py"))
tools_modules = [
str(i.relative_to(ROOT_DIR))[:-3].replace("/", ".")
for i in tools_sources
if i.stem not in unwanted_tools
]
create_one_file(
"pytorch3d.implicitron.tools",
"Tools for implicitron",
tools_modules,
DEST_DIR / "tools.rst",
)

dataset_files = sorted(ROOT_DIR.glob("pytorch3d/implicitron/dataset/*.py"))
basic_dataset = [
"dataset_base",
"dataset_map_provider",
"data_loader_map_provider",
"data_source",
"scene_batch_sampler",
]
basic_dataset_modules = [
f"pytorch3d.implicitron.dataset.{i}" for i in basic_dataset
]
create_one_file(
"pytorch3d.implicitron.dataset in general",
"Basics of data for implicitron",
basic_dataset_modules,
DEST_DIR / "data_basics.rst",
)

specific_dataset_files = [
i for i in dataset_files if i.stem.find("_dataset_map_provider") != -1
]
create_one_file(
"pytorch3d.implicitron.dataset specific datasets",
"specific datasets",
paths_to_modules(specific_dataset_files),
DEST_DIR / "datasets.rst",
)

evaluation_files = sorted(ROOT_DIR.glob("pytorch3d/implicitron/evaluation/*.py"))
create_one_file(
"pytorch3d.implicitron.evaluation",
"evaluation",
paths_to_modules(evaluation_files),
DEST_DIR / "evaluation.rst",
)

make_directory_index("pytorch3d.implicitron", DEST_DIR)


def iterate_toplevel_module(name: str) -> None:
dest_dir = Path(__file__).resolve().parent / "modules" / name
iterate_directory(ROOT_DIR / "pytorch3d" / name, dest_dir)


do_implicitron()
iterate_toplevel_module("renderer")
iterate_toplevel_module("vis")
2 changes: 1 addition & 1 deletion docs/modules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ API Documentation
utils
datasets
common
vis
vis/index
implicitron/index
6 changes: 4 additions & 2 deletions docs/modules/renderer/blending.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
blending
pytorch3d.renderer.blending
===========================

blending

.. automodule:: pytorch3d.renderer.blending
:members:
:undoc-members:
:show-inheritance:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/camera_conversions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.camera_conversions
=====================================

camera_conversions

.. automodule:: pytorch3d.renderer.camera_conversions
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/camera_utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.camera_utils
===============================

camera_utils

.. automodule:: pytorch3d.renderer.camera_utils
:members:
:undoc-members:
:show-inheritance:
6 changes: 4 additions & 2 deletions docs/modules/renderer/cameras.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pytorch3d.renderer.cameras
==========================

cameras
===========================

.. automodule:: pytorch3d.renderer.cameras
:members:
:undoc-members:
:show-inheritance:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/compositing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.compositing
==============================

compositing

.. automodule:: pytorch3d.renderer.compositing
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/fisheyecameras.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.fisheyecameras
=================================

fisheyecameras

.. automodule:: pytorch3d.renderer.fisheyecameras
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/implicit/harmonic_embedding.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.implicit.harmonic_embedding
==============================================

harmonic_embedding

.. automodule:: pytorch3d.renderer.implicit.harmonic_embedding
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions docs/modules/renderer/implicit/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pytorch3d.renderer.implicit
===========================

.. toctree::

harmonic_embedding
raymarching
raysampling
renderer
sample_pdf
utils
9 changes: 9 additions & 0 deletions docs/modules/renderer/implicit/raymarching.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.implicit.raymarching
=======================================

raymarching

.. automodule:: pytorch3d.renderer.implicit.raymarching
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/implicit/raysampling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.implicit.raysampling
=======================================

raysampling

.. automodule:: pytorch3d.renderer.implicit.raysampling
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/implicit/renderer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.implicit.renderer
====================================

renderer

.. automodule:: pytorch3d.renderer.implicit.renderer
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/implicit/sample_pdf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.implicit.sample_pdf
======================================

sample_pdf

.. automodule:: pytorch3d.renderer.implicit.sample_pdf
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/implicit/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.implicit.utils
=================================

utils

.. automodule:: pytorch3d.renderer.implicit.utils
:members:
:undoc-members:
:show-inheritance:
22 changes: 13 additions & 9 deletions docs/modules/renderer/index.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
pytorch3d.renderer
===========================
pytorch3d.renderer
==================

.. toctree::

rasterizer
blending
camera_conversions
camera_utils
cameras
compositing
fisheyecameras
lighting
materials
texturing
blending
shading
shader
renderer
utils
splatter_blend
utils
implicit/index
mesh/index
opengl/index
points/index
7 changes: 5 additions & 2 deletions docs/modules/renderer/lighting.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
lighting
pytorch3d.renderer.lighting
===========================

lighting

.. automodule:: pytorch3d.renderer.lighting
:members:
:undoc-members:
:undoc-members:
:show-inheritance:
6 changes: 4 additions & 2 deletions docs/modules/renderer/materials.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pytorch3d.renderer.materials
============================

materials
===========================

.. automodule:: pytorch3d.renderer.materials
:members:
:undoc-members:
:show-inheritance:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/mesh/clip.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.mesh.clip
============================

clip

.. automodule:: pytorch3d.renderer.mesh.clip
:members:
:undoc-members:
:show-inheritance:
13 changes: 13 additions & 0 deletions docs/modules/renderer/mesh/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pytorch3d.renderer.mesh
=======================

.. toctree::

clip
rasterize_meshes
rasterizer
renderer
shader
shading
textures
utils
9 changes: 9 additions & 0 deletions docs/modules/renderer/mesh/rasterize_meshes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.mesh.rasterize_meshes
========================================

rasterize_meshes

.. automodule:: pytorch3d.renderer.mesh.rasterize_meshes
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/mesh/rasterizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.mesh.rasterizer
==================================

rasterizer

.. automodule:: pytorch3d.renderer.mesh.rasterizer
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/modules/renderer/mesh/renderer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytorch3d.renderer.mesh.renderer
================================

renderer

.. automodule:: pytorch3d.renderer.mesh.renderer
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pytorch3d.renderer.mesh.shader
==============================

shader
===========================

.. automodule:: pytorch3d.renderer.mesh.shader
:members:
:undoc-members:

:show-inheritance:
Loading

0 comments on commit 9a0b0c2

Please sign in to comment.