Unverified Commit 1216e5fe authored by Zaida Zhou's avatar Zaida Zhou Committed by GitHub
Browse files

[Docs] Use PyTorch sphinx theme (#1321)

* [Docs] Use PyTorch sphinx theme

* add sphinx-copybutton

* add twitter and zhihu link

* remove shpinx_rtd_theme from doc.xtx

* update docs.txt

* update conf.py
parent 6434d0d7
.header-logo {
background-image: url("../image/mmcv-logo.png");
background-size: 85px 40px;
height: 40px;
width: 85px;
}
API Reference
=================
fileio fileio
------- -------
.. automodule:: mmcv.fileio .. automodule:: mmcv.fileio
......
Community
===========
.. toctree::
:maxdepth: 2
community/contributing.md
community/pr.md
## Compatibility of MMCV ### v1.3.11
### MMCV v1.3.11
In order to flexibly support more backends and hardwares like `NVIDIA GPUs` and `AMD GPUs`, the directory of `mmcv/ops/csrc` is refactored. Note that this refactoring will not affect the usage in API. For related information, please refer to [PR1206](https://github.com/open-mmlab/mmcv/pull/1206). In order to flexibly support more backends and hardwares like `NVIDIA GPUs` and `AMD GPUs`, the directory of `mmcv/ops/csrc` is refactored. Note that this refactoring will not affect the usage in API. For related information, please refer to [PR1206](https://github.com/open-mmlab/mmcv/pull/1206).
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
import os import os
import sys import sys
import pytorch_sphinx_theme
from m2r import MdInclude from m2r import MdInclude
from recommonmark.transform import AutoStructify from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.builders.html import StandaloneHTMLBuilder
...@@ -53,6 +54,7 @@ extensions = [ ...@@ -53,6 +54,7 @@ extensions = [
'sphinx.ext.autosectionlabel', 'sphinx.ext.autosectionlabel',
'sphinx_markdown_tables', 'sphinx_markdown_tables',
'myst_parser', 'myst_parser',
'sphinx_copybutton',
] # yapf: disable ] # yapf: disable
autodoc_mock_imports = ['mmcv._ext', 'mmcv.utils.ext_loader', 'torchvision'] autodoc_mock_imports = ['mmcv._ext', 'mmcv.utils.ext_loader', 'torchvision']
...@@ -92,18 +94,97 @@ pygments_style = 'sphinx' ...@@ -92,18 +94,97 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
# #
html_theme = 'sphinx_rtd_theme' # html_theme = 'sphinx_rtd_theme'
html_theme = 'pytorch_sphinx_theme'
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
# #
# html_theme_options = {} html_theme_options = {
# 'logo_url': 'https://mmocr.readthedocs.io/en/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmcv'
},
{
'name':
'Projects',
'children': [
{
'name': 'MMAction2',
'url': 'https://github.com/open-mmlab/mmaction2',
},
{
'name': 'MMClassification',
'url': 'https://github.com/open-mmlab/mmclassification',
},
{
'name': 'MMDetection',
'url': 'https://github.com/open-mmlab/mmdetection',
},
{
'name': 'MMDetection3D',
'url': 'https://github.com/open-mmlab/mmdetection3d',
},
{
'name': 'MMEditing',
'url': 'https://github.com/open-mmlab/mmediting',
},
{
'name': 'MMGeneration',
'url': 'https://github.com/open-mmlab/mmgeneration',
},
{
'name': 'MMOCR',
'url': 'https://github.com/open-mmlab/mmocr',
},
{
'name': 'MMPose',
'url': 'https://github.com/open-mmlab/mmpose',
},
{
'name': 'MMSegmentation',
'url': 'https://github.com/open-mmlab/mmsegmentation',
},
{
'name': 'MMTracking',
'url': 'https://github.com/open-mmlab/mmtracking',
},
]
},
{
'name':
'OpenMMLab',
'children': [
{
'name': 'Homepage',
'url': 'https://openmmlab.com/'
},
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/'
},
{
'name': 'Twitter',
'url': 'https://twitter.com/OpenMMLab'
},
{
'name': 'Zhihu',
'url': 'https://zhihu.com/people/openmmlab'
},
]
},
]
}
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static'] html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']
# Custom sidebar templates, must be a dictionary that maps document names # Custom sidebar templates, must be a dictionary that maps document names
# to template names. # to template names.
...@@ -144,7 +225,8 @@ latex_elements = { ...@@ -144,7 +225,8 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'mmcv.tex', 'mmcv Documentation', 'Kai Chen', 'manual'), (master_doc, 'mmcv.tex', 'mmcv Documentation', 'MMCV Contributors',
'manual'),
] ]
# -- Options for manual page output ------------------------------------------ # -- Options for manual page output ------------------------------------------
...@@ -185,6 +267,9 @@ StandaloneHTMLBuilder.supported_image_types = [ ...@@ -185,6 +267,9 @@ StandaloneHTMLBuilder.supported_image_types = [
'image/svg+xml', 'image/gif', 'image/png', 'image/jpeg' 'image/svg+xml', 'image/gif', 'image/png', 'image/jpeg'
] ]
# -- Extension configuration ------------------------------------------------- # -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_is_regexp = True
def setup(app): def setup(app):
......
Deployment
================
.. toctree::
:maxdepth: 2
deployment/onnx.md
deployment/onnxruntime_op.md
deployment/onnxruntime_custom_ops.md
deployment/tensorrt_plugin.md
deployment/tensorrt_custom_ops.md
Get started
===================
.. toctree::
:maxdepth: 2
get_started/introduction.md
get_started/installation.md
get_started/build.md
...@@ -54,13 +54,13 @@ For more details, please refer the the following tables. ...@@ -54,13 +54,13 @@ For more details, please refer the the following tables.
<tbody> <tbody>
<tr> <tr>
<th width="80"> CUDA </th> <th width="80"> CUDA </th>
<th valign="bottom" align="left" width="100">torch 1.9</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.9</th>
<th valign="bottom" align="left" width="100">torch 1.8</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.8</th>
<th valign="bottom" align="left" width="100">torch 1.7</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.7</th>
<th valign="bottom" align="left" width="100">torch 1.6</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.6</th>
<th valign="bottom" align="left" width="100">torch 1.5</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.5</th>
<th valign="bottom" align="left" width="100">torch 1.4</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.4</th>
<th valign="bottom" align="left" width="100">torch 1.3</th> <th valign="bottom" align="left" style="min-width: 100px">torch 1.3</th>
</tr> </tr>
<tr> <tr>
<td align="left">11.1</td> <td align="left">11.1</td>
......
## Introduction ## Introduction
<div align="center">
<img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/mmcv-logo.png" width="300"/>
</div>
MMCV is a foundational library for computer vision research and supports many MMCV is a foundational library for computer vision research and supports many
research projects as below: research projects as below:
......
...@@ -4,16 +4,61 @@ Welcome to MMCV's documentation! ...@@ -4,16 +4,61 @@ Welcome to MMCV's documentation!
You can switch between Chinese and English documents in the lower-left corner of the layout. You can switch between Chinese and English documents in the lower-left corner of the layout.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 1
:caption: Get Started
get_started/introduction.md
get_started/installation.md
get_started/build.md
.. toctree::
:maxdepth: 1
:caption: Understand MMCV
understand_mmcv/config.md
understand_mmcv/registry.md
understand_mmcv/runner.md
understand_mmcv/io.md
understand_mmcv/data_process.md
understand_mmcv/visualization.md
understand_mmcv/cnn.md
understand_mmcv/ops.md
understand_mmcv/utils.md
.. toctree::
:maxdepth: 1
:caption: Deployment
deployment/onnx.md
deployment/onnxruntime_op.md
deployment/onnxruntime_custom_ops.md
deployment/tensorrt_plugin.md
deployment/tensorrt_custom_ops.md
.. toctree::
:maxdepth: 1
:caption: Compatibility
get_started.rst
understand_mmcv.rst
deployment.rst
compatibility.md compatibility.md
.. toctree::
:maxdepth: 1
:caption: FAQ
faq.md faq.md
community.rst
api.rst
.. toctree::
:maxdepth: 1
:caption: Community
community/contributing.md
community/pr.md
.. toctree::
:maxdepth: 1
:caption: API Reference
api.rst
Indices and tables Indices and tables
================== ==================
......
Understand MMCV
=================
.. toctree::
:maxdepth: 2
understand_mmcv/config.md
understand_mmcv/registry.md
understand_mmcv/runner.md
understand_mmcv/io.md
understand_mmcv/data_process.md
understand_mmcv/visualization.md
understand_mmcv/cnn.md
understand_mmcv/ops.md
understand_mmcv/utils.md
.header-logo {
background-image: url("../image/mmcv-logo.png");
background-size: 85px 40px;
height: 40px;
width: 85px;
}
API 文档
=========
fileio fileio
------- -------
.. automodule:: mmcv.fileio .. automodule:: mmcv.fileio
......
社区
===========
.. toctree::
:maxdepth: 2
community/contributing.md
community/pr.md
## MMCV 兼容性说明 ### v1.3.11
### MMCV v1.3.11
为了灵活地支持更多的后端和硬件,例如 `NVIDIA GPUs``AMD GPUs`,我们重构了 `mmcv/ops/csrc` 目录。注意,这次重构不会影响 API 的使用。更多相关信息,请参考 [PR1206](https://github.com/open-mmlab/mmcv/pull/1206) 为了灵活地支持更多的后端和硬件,例如 `NVIDIA GPUs``AMD GPUs`,我们重构了 `mmcv/ops/csrc` 目录。注意,这次重构不会影响 API 的使用。更多相关信息,请参考 [PR1206](https://github.com/open-mmlab/mmcv/pull/1206)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
import os import os
import sys import sys
import pytorch_sphinx_theme
from m2r import MdInclude from m2r import MdInclude
from recommonmark.transform import AutoStructify from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.builders.html import StandaloneHTMLBuilder
...@@ -53,6 +54,7 @@ extensions = [ ...@@ -53,6 +54,7 @@ extensions = [
'sphinx.ext.autosectionlabel', 'sphinx.ext.autosectionlabel',
'sphinx_markdown_tables', 'sphinx_markdown_tables',
'myst_parser', 'myst_parser',
'sphinx_copybutton',
] # yapf: disable ] # yapf: disable
autodoc_mock_imports = ['mmcv._ext', 'mmcv.utils.ext_loader', 'torchvision'] autodoc_mock_imports = ['mmcv._ext', 'mmcv.utils.ext_loader', 'torchvision']
...@@ -92,18 +94,97 @@ pygments_style = 'sphinx' ...@@ -92,18 +94,97 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
# #
html_theme = 'sphinx_rtd_theme' # html_theme = 'sphinx_rtd_theme'
html_theme = 'pytorch_sphinx_theme'
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
# #
# html_theme_options = {} html_theme_options = {
# 'logo_url': 'https://mmocr.readthedocs.io/en/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmcv'
},
{
'name':
'算法库',
'children': [
{
'name': 'MMAction2',
'url': 'https://github.com/open-mmlab/mmaction2',
},
{
'name': 'MMClassification',
'url': 'https://github.com/open-mmlab/mmclassification',
},
{
'name': 'MMDetection',
'url': 'https://github.com/open-mmlab/mmdetection',
},
{
'name': 'MMDetection3D',
'url': 'https://github.com/open-mmlab/mmdetection3d',
},
{
'name': 'MMEditing',
'url': 'https://github.com/open-mmlab/mmediting',
},
{
'name': 'MMGeneration',
'url': 'https://github.com/open-mmlab/mmgeneration',
},
{
'name': 'MMOCR',
'url': 'https://github.com/open-mmlab/mmocr',
},
{
'name': 'MMPose',
'url': 'https://github.com/open-mmlab/mmpose',
},
{
'name': 'MMSegmentation',
'url': 'https://github.com/open-mmlab/mmsegmentation',
},
{
'name': 'MMTracking',
'url': 'https://github.com/open-mmlab/mmtracking',
},
]
},
{
'name':
'OpenMMLab',
'children': [
{
'name': '官网',
'url': 'https://openmmlab.com/'
},
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/'
},
{
'name': '推特',
'url': 'https://twitter.com/OpenMMLab'
},
{
'name': '知乎',
'url': 'https://zhihu.com/people/openmmlab'
},
]
},
]
}
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['../docs/_static'] html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']
# Custom sidebar templates, must be a dictionary that maps document names # Custom sidebar templates, must be a dictionary that maps document names
# to template names. # to template names.
...@@ -144,7 +225,8 @@ latex_elements = { ...@@ -144,7 +225,8 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'mmcv.tex', 'mmcv Documentation', 'Kai Chen', 'manual'), (master_doc, 'mmcv.tex', 'mmcv Documentation', 'MMCV Contributors',
'manual'),
] ]
# -- Options for manual page output ------------------------------------------ # -- Options for manual page output ------------------------------------------
...@@ -185,6 +267,9 @@ StandaloneHTMLBuilder.supported_image_types = [ ...@@ -185,6 +267,9 @@ StandaloneHTMLBuilder.supported_image_types = [
'image/svg+xml', 'image/gif', 'image/png', 'image/jpeg' 'image/svg+xml', 'image/gif', 'image/png', 'image/jpeg'
] ]
# -- Extension configuration ------------------------------------------------- # -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_is_regexp = True
def setup(app): def setup(app):
......
部署
========
.. toctree::
:maxdepth: 2
deployment/onnx.md
deployment/onnxruntime_op.md
deployment/onnxruntime_custom_ops.md
deployment/tensorrt_plugin.md
deployment/tensorrt_custom_ops.md
介绍及安装
===================
.. toctree::
:maxdepth: 2
get_started/introduction.md
get_started/installation.md
get_started/build.md
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment