Skip to content

Commit a27522c

Browse files
authored
Change betastatus doc warning and v2 import warning (#7329)
1 parent 92d75e6 commit a27522c

13 files changed

+73
-61
lines changed

docs/source/beta_status.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,26 @@
44

55
class BetaStatus(Directive):
66
has_content = True
7+
text = "The {api_name} is in Beta stage, and backward compatibility is not guaranteed."
78

89
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."
10+
text = self.text.format(api_name=" ".join(self.content))
1111
return [nodes.warning("", nodes.paragraph("", "", nodes.Text(text)))]
1212

1313

14+
class V2BetaStatus(BetaStatus):
15+
text = (
16+
"The {api_name} is in Beta stage, and while we do not expect major breaking changes, "
17+
"some APIs may still change according to user feedback. Please submit any feedback you may have "
18+
"in this issue: https://github.com/pytorch/vision/issues/6753, and you can also check "
19+
"out https://github.com/pytorch/vision/issues/7319 to learn "
20+
"more about the APIs that we suspect might involve future changes."
21+
)
22+
23+
1424
def setup(app):
1525
app.add_directive("betastatus", BetaStatus)
26+
app.add_directive("v2betastatus", V2BetaStatus)
1627
return {
1728
"version": "0.1",
1829
"parallel_read_safe": True,

docs/source/transforms.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Transforming and augmenting images
1616
:ref:`sphx_glr_auto_examples_plot_transforms_v2_e2e.py`.
1717
Note that these transforms are still BETA, and while we don't expect major
1818
breaking changes in the future, some APIs may still change according to user
19-
feedback. Please submit any feedback you may have in
20-
https://github.com/pytorch/vision/issues/6753, and you can also check out
21-
https://github.com/pytorch/vision/issues/7319 to learn more about the APIs
22-
that we suspect might involve future changes.
19+
feedback. Please submit any feedback you may have `here
20+
<https://github.com/pytorch/vision/issues/6753>`_, and you can also check
21+
out `this issue <https://github.com/pytorch/vision/issues/7319>`_ to learn
22+
more about the APIs that we suspect might involve future changes.
2323

2424
Transforms are common image transformations available in the
2525
``torchvision.transforms`` module. They can be chained together using

torchvision/__init__.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ def _is_tracing():
100100
_WARN_ABOUT_BETA_TRANSFORMS = True
101101
_BETA_TRANSFORMS_WARNING = (
102102
"The torchvision.datapoints and torchvision.transforms.v2 namespaces are still Beta. "
103-
"While we will try our best to maintain backward compatibility, "
104-
"some APIs or behaviors might change without a deprecation cycle. "
105-
"To help us improve these new features, please provide your feedback "
106-
"here: https://github.com/pytorch/vision/issues/6753."
103+
"While we do not expect major breaking changes, some APIs may still change "
104+
"according to user feedback. Please submit any feedback you may have in "
105+
"this issue: https://github.com/pytorch/vision/issues/6753, and you can also "
106+
"check out https://github.com/pytorch/vision/issues/7319 to learn more about "
107+
"the APIs that we suspect might involve future changes. "
107108
"You can silence this warning by calling torchvision.disable_beta_transform_warning()."
108109
)
109110

torchvision/transforms/v2/_augment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class RandomErasing(_RandomApplyTransform):
1616
"""[BETA] Randomly select a rectangle region in the input image or video and erase its pixels.
1717
18-
.. betastatus:: RandomErasing transform
18+
.. v2betastatus:: RandomErasing transform
1919
2020
This transform does not support PIL Image.
2121
'Random Erasing Data Augmentation' by Zhong et al. See https://arxiv.org/abs/1708.04896

torchvision/transforms/v2/_auto_augment.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class AutoAugment(_AutoAugmentBase):
165165
r"""[BETA] AutoAugment data augmentation method based on
166166
`"AutoAugment: Learning Augmentation Strategies from Data" <https://arxiv.org/pdf/1805.09501.pdf>`_.
167167
168-
.. betastatus:: AutoAugment transform
168+
.. v2betastatus:: AutoAugment transform
169169
170170
This transformation works on images and videos only.
171171
@@ -342,7 +342,7 @@ class RandAugment(_AutoAugmentBase):
342342
`"RandAugment: Practical automated data augmentation with a reduced search space"
343343
<https://arxiv.org/abs/1909.13719>`_.
344344
345-
.. betastatus:: RandAugment transform
345+
.. v2betastatus:: RandAugment transform
346346
347347
This transformation works on images and videos only.
348348
@@ -425,7 +425,7 @@ class TrivialAugmentWide(_AutoAugmentBase):
425425
r"""[BETA] Dataset-independent data-augmentation with TrivialAugment Wide, as described in
426426
`"TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation" <https://arxiv.org/abs/2103.10158>`_.
427427
428-
.. betastatus:: TrivialAugmentWide transform
428+
.. v2betastatus:: TrivialAugmentWide transform
429429
430430
This transformation works on images and videos only.
431431
@@ -496,7 +496,7 @@ class AugMix(_AutoAugmentBase):
496496
r"""[BETA] AugMix data augmentation method based on
497497
`"AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty" <https://arxiv.org/abs/1912.02781>`_.
498498
499-
.. betastatus:: AugMix transform
499+
.. v2betastatus:: AugMix transform
500500
501501
This transformation works on images and videos only.
502502

torchvision/transforms/v2/_color.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class Grayscale(Transform):
1414
"""[BETA] Convert images or videos to grayscale.
1515
16-
.. betastatus:: Grayscale transform
16+
.. v2betastatus:: Grayscale transform
1717
1818
If the input is a :class:`torch.Tensor`, it is expected
1919
to have [..., 3 or 1, H, W] shape, where ... means an arbitrary number of leading dimensions
@@ -42,7 +42,7 @@ def _transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
4242
class RandomGrayscale(_RandomApplyTransform):
4343
"""[BETA] Randomly convert image or videos to grayscale with a probability of p (default 0.1).
4444
45-
.. betastatus:: RandomGrayscale transform
45+
.. v2betastatus:: RandomGrayscale transform
4646
4747
If the input is a :class:`torch.Tensor`, it is expected to have [..., 3 or 1, H, W] shape,
4848
where ... means an arbitrary number of leading dimensions
@@ -76,7 +76,7 @@ def _transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
7676
class ColorJitter(Transform):
7777
"""[BETA] Randomly change the brightness, contrast, saturation and hue of an image or video.
7878
79-
.. betastatus:: ColorJitter transform
79+
.. v2betastatus:: ColorJitter transform
8080
8181
If the input is a :class:`torch.Tensor`, it is expected
8282
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
@@ -182,7 +182,7 @@ class RandomPhotometricDistort(Transform):
182182
"""[BETA] Randomly distorts the image or video as used in `SSD: Single Shot
183183
MultiBox Detector <https://arxiv.org/abs/1512.02325>`_.
184184
185-
.. betastatus:: RandomPhotometricDistort transform
185+
.. v2betastatus:: RandomPhotometricDistort transform
186186
187187
This transform relies on :class:`~torchvision.transforms.v2.ColorJitter`
188188
under the hood to adjust the contrast, saturation, hue, brightness, and also
@@ -282,7 +282,7 @@ def _transform(
282282
class RandomEqualize(_RandomApplyTransform):
283283
"""[BETA] Equalize the histogram of the given image or video with a given probability.
284284
285-
.. betastatus:: RandomEqualize transform
285+
.. v2betastatus:: RandomEqualize transform
286286
287287
If the input is a :class:`torch.Tensor`, it is expected
288288
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
@@ -301,7 +301,7 @@ def _transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
301301
class RandomInvert(_RandomApplyTransform):
302302
"""[BETA] Inverts the colors of the given image or video with a given probability.
303303
304-
.. betastatus:: RandomInvert transform
304+
.. v2betastatus:: RandomInvert transform
305305
306306
If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format,
307307
where ... means it can have an arbitrary number of leading dimensions.
@@ -321,7 +321,7 @@ class RandomPosterize(_RandomApplyTransform):
321321
"""[BETA] Posterize the image or video with a given probability by reducing the
322322
number of bits for each color channel.
323323
324-
.. betastatus:: RandomPosterize transform
324+
.. v2betastatus:: RandomPosterize transform
325325
326326
If the input is a :class:`torch.Tensor`, it should be of type torch.uint8,
327327
and it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
@@ -346,7 +346,7 @@ class RandomSolarize(_RandomApplyTransform):
346346
"""[BETA] Solarize the image or video with a given probability by inverting all pixel
347347
values above a threshold.
348348
349-
.. betastatus:: RandomSolarize transform
349+
.. v2betastatus:: RandomSolarize transform
350350
351351
If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format,
352352
where ... means it can have an arbitrary number of leading dimensions.
@@ -370,7 +370,7 @@ def _transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
370370
class RandomAutocontrast(_RandomApplyTransform):
371371
"""[BETA] Autocontrast the pixels of the given image or video with a given probability.
372372
373-
.. betastatus:: RandomAutocontrast transform
373+
.. v2betastatus:: RandomAutocontrast transform
374374
375375
If the input is a :class:`torch.Tensor`, it is expected
376376
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
@@ -389,7 +389,7 @@ def _transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
389389
class RandomAdjustSharpness(_RandomApplyTransform):
390390
"""[BETA] Adjust the sharpness of the image or video with a given probability.
391391
392-
.. betastatus:: RandomAdjustSharpness transform
392+
.. v2betastatus:: RandomAdjustSharpness transform
393393
394394
If the input is a :class:`torch.Tensor`,
395395
it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.

torchvision/transforms/v2/_container.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Compose(Transform):
1111
"""[BETA] Composes several transforms together.
1212
13-
.. betastatus:: Compose transform
13+
.. v2betastatus:: Compose transform
1414
1515
This transform does not support torchscript.
1616
Please, see the note below.
@@ -61,7 +61,7 @@ def extra_repr(self) -> str:
6161
class RandomApply(Transform):
6262
"""[BETA] Apply randomly a list of transformations with a given probability.
6363
64-
.. betastatus:: RandomApply transform
64+
.. v2betastatus:: RandomApply transform
6565
6666
.. note::
6767
In order to script the transformation, please use ``torch.nn.ModuleList`` as input instead of list/tuple of
@@ -116,7 +116,7 @@ def extra_repr(self) -> str:
116116
class RandomChoice(Transform):
117117
"""[BETA] Apply single transformation randomly picked from a list.
118118
119-
.. betastatus:: RandomChoice transform
119+
.. v2betastatus:: RandomChoice transform
120120
121121
This transform does not support torchscript.
122122
@@ -155,7 +155,7 @@ def forward(self, *inputs: Any) -> Any:
155155
class RandomOrder(Transform):
156156
"""[BETA] Apply a list of transformations in a random order.
157157
158-
.. betastatus:: RandomOrder transform
158+
.. v2betastatus:: RandomOrder transform
159159
160160
This transform does not support torchscript.
161161

torchvision/transforms/v2/_deprecated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class ToTensor(Transform):
1313
"""[BETA] Convert a PIL Image or ndarray to tensor and scale the values accordingly.
1414
15-
.. betastatus:: ToTensor transform
15+
.. v2betastatus:: ToTensor transform
1616
1717
.. warning::
1818
:class:`v2.ToTensor` is deprecated and will be removed in a future release.

0 commit comments

Comments
 (0)