Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
276ee2ae
Unverified
Commit
276ee2ae
authored
Feb 17, 2023
by
Nicolas Hug
Committed by
GitHub
Feb 17, 2023
Browse files
Add a removable warning in torchvision.transforms.v2 and torchvision.datapoints (#7270)
parent
cb5f7835
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
0 deletions
+34
-0
test/conftest.py
test/conftest.py
+4
-0
torchvision/__init__.py
torchvision/__init__.py
+16
-0
torchvision/datapoints/__init__.py
torchvision/datapoints/__init__.py
+7
-0
torchvision/transforms/v2/__init__.py
torchvision/transforms/v2/__init__.py
+7
-0
No files found.
test/conftest.py
View file @
276ee2ae
...
...
@@ -3,9 +3,13 @@ import random
import
numpy
as
np
import
pytest
import
torch
import
torchvision
from
common_utils
import
CUDA_NOT_AVAILABLE_MSG
,
IN_FBCODE
,
IN_OSS_CI
,
IN_RE_WORKER
,
OSS_CI_GPU_NO_CUDA_MSG
torchvision
.
disable_beta_transforms_warning
()
def
pytest_configure
(
config
):
# register an additional marker (see pytest_collection_modifyitems)
config
.
addinivalue_line
(
"markers"
,
"needs_cuda: mark for tests that rely on a CUDA device"
)
...
...
torchvision/__init__.py
View file @
276ee2ae
...
...
@@ -95,3 +95,19 @@ def get_video_backend():
def
_is_tracing
():
return
torch
.
_C
.
_get_tracing_state
()
_WARN_ABOUT_BETA_TRANSFORMS
=
True
_BETA_TRANSFORMS_WARNING
=
(
"The torchvision.datapoints and torchvision.transforms.v2 namespaces are still Beta. "
"While we will try our best to maintain backward compatibility, "
"some APIs or behaviors might change without a deprecation cycle. "
"To help us improve these new features, please provide your feedback "
"here: https://github.com/pytorch/vision/issues/6753."
"You can silence this warning by calling torchvision.disable_beta_transform_warning()."
)
def
disable_beta_transforms_warning
():
global
_WARN_ABOUT_BETA_TRANSFORMS
_WARN_ABOUT_BETA_TRANSFORMS
=
False
torchvision/datapoints/__init__.py
View file @
276ee2ae
...
...
@@ -5,3 +5,10 @@ from ._mask import Mask
from
._video
import
_TensorVideoType
,
_TensorVideoTypeJIT
,
_VideoType
,
_VideoTypeJIT
,
Video
from
._dataset_wrapper
import
wrap_dataset_for_transforms_v2
# type: ignore[attr-defined] # usort: skip
from
torchvision
import
_BETA_TRANSFORMS_WARNING
,
_WARN_ABOUT_BETA_TRANSFORMS
if
_WARN_ABOUT_BETA_TRANSFORMS
:
import
warnings
warnings
.
warn
(
_BETA_TRANSFORMS_WARNING
)
torchvision/transforms/v2/__init__.py
View file @
276ee2ae
...
...
@@ -45,3 +45,10 @@ from ._temporal import UniformTemporalSubsample
from
._type_conversion
import
PILToTensor
,
ToImagePIL
,
ToImageTensor
,
ToPILImage
from
._deprecated
import
ToTensor
# usort: skip
from
torchvision
import
_BETA_TRANSFORMS_WARNING
,
_WARN_ABOUT_BETA_TRANSFORMS
if
_WARN_ABOUT_BETA_TRANSFORMS
:
import
warnings
warnings
.
warn
(
_BETA_TRANSFORMS_WARNING
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment