Skip to content

Commit b3d5c78

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Add new .. betastatus:: directive and document Beta APIs (#6115)
Summary: * Add new .. betastatus:: directive to document Beta APIs * Also add it for the fine-grained video API * Add directive for all builders and pages of Detection module * Also segmentation and video models Reviewed By: datumbox Differential Revision: D37212650 fbshipit-source-id: 05bfde6fcb9d07238777daeac3814f4c94ddf718
1 parent eb19b22 commit b3d5c78

28 files changed

+97
-0
lines changed

docs/source/beta_status.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from docutils import nodes
2+
from docutils.parsers.rst import Directive
3+
4+
5+
class BetaStatus(Directive):
6+
has_content = True
7+
8+
def run(self):
9+
api_name = " ".join(self.content)
10+
text = f"The {api_name} is in Beta stage, and backward compatibility is not guaranteed."
11+
return [nodes.warning("", nodes.paragraph("", "", nodes.Text(text)))]
12+
13+
14+
def setup(app):
15+
app.add_directive("betastatus", BetaStatus)
16+
return {
17+
"version": "0.1",
18+
"parallel_read_safe": True,
19+
"parallel_write_safe": True,
20+
}

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# sys.path.insert(0, os.path.abspath('.'))
2222

2323
import os
24+
import sys
2425
import textwrap
2526
from copy import copy
2627
from pathlib import Path
@@ -30,6 +31,7 @@
3031
import torchvision.models as M
3132
from tabulate import tabulate
3233

34+
sys.path.append(os.path.abspath("."))
3335

3436
# -- General configuration ------------------------------------------------
3537

@@ -50,6 +52,7 @@
5052
"sphinx.ext.duration",
5153
"sphinx_gallery.gen_gallery",
5254
"sphinx_copybutton",
55+
"beta_status",
5356
]
5457

5558
sphinx_gallery_conf = {

docs/source/io.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ In addition to the :mod:`read_video` function, we provide a high-performance
2626
lower-level API for more fine-grained control compared to the :mod:`read_video` function.
2727
It does all this whilst fully supporting torchscript.
2828

29+
.. betastatus:: fine-grained video API
30+
2931
.. autosummary::
3032
:toctree: generated/
3133
:template: class.rst

docs/source/models.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ Semantic Segmentation
272272

273273
.. currentmodule:: torchvision.models.segmentation
274274

275+
.. betastatus:: segmentation module
276+
275277
The following semantic segmentation models are available, with or without
276278
pre-trained weights:
277279

@@ -334,6 +336,8 @@ keypoint detection are initialized with the classification models
334336
in torchvision. The models expect a list of ``Tensor[C, H, W]``.
335337
Check the constructor of the models for more information.
336338

339+
.. betastatus:: detection module
340+
337341
Object Detection
338342
----------------
339343

@@ -453,6 +457,8 @@ Video Classification
453457

454458
.. currentmodule:: torchvision.models.video
455459

460+
.. betastatus:: video module
461+
456462
The following video classification models are available, with or without
457463
pre-trained weights:
458464

docs/source/models/deeplabv3.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ DeepLabV3
66
The DeepLabV3 model is based on the `Rethinking Atrous Convolution for Semantic
77
Image Segmentation <https://arxiv.org/abs/1706.05587>`__ paper.
88

9+
.. betastatus:: segmentation module
10+
911

1012
Model builders
1113
--------------

docs/source/models/faster_rcnn.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ Faster R-CNN
33

44
.. currentmodule:: torchvision.models.detection
55

6+
67
The Faster R-CNN model is based on the `Faster R-CNN: Towards Real-Time Object Detection
78
with Region Proposal Networks <https://arxiv.org/abs/1506.01497>`__
89
paper.
910

11+
.. betastatus:: detection module
1012

1113
Model builders
1214
--------------

docs/source/models/fcn.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The FCN model is based on the `Fully Convolutional Networks for Semantic
77
Segmentation <https://arxiv.org/abs/1411.4038>`__
88
paper.
99

10+
.. betastatus:: segmentation module
11+
1012

1113
Model builders
1214
--------------

docs/source/models/fcos.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ FCOS
66
The RetinaNet model is based on the `FCOS: Fully Convolutional One-Stage Object Detection
77
<https://arxiv.org/abs/1904.01355>`__ paper.
88

9+
.. betastatus:: detection module
10+
911
Model builders
1012
--------------
1113

docs/source/models/keypoint_rcnn.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Keypoint R-CNN
66
The Keypoint R-CNN model is based on the `Mask R-CNN
77
<https://arxiv.org/abs/1703.06870>`__ paper.
88

9+
.. betastatus:: detection module
10+
911

1012
Model builders
1113
--------------

docs/source/models/lraspp.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LRASPP
55

66
The LRASPP model is based on the `Searching for MobileNetV3 <https://arxiv.org/abs/1905.02244>`_ paper.
77

8+
.. betastatus:: segmentation module
9+
810
Model builders
911
--------------
1012

0 commit comments

Comments
 (0)