We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 039c928 commit 42e7f1fCopy full SHA for 42e7f1f
torchvision/__init__.py
@@ -1,4 +1,5 @@
1
import warnings
2
+import os
3
4
from .extension import _HAS_OPS
5
@@ -16,6 +17,14 @@
16
17
except ImportError:
18
pass
19
20
+# Check if torchvision is being imported within the root folder
21
+if (not _HAS_OPS and os.path.dirname(os.path.realpath(__file__)) ==
22
+ os.path.join(os.path.realpath(os.getcwd()), 'torchvision')):
23
+ message = ('You are importing torchvision within its own root folder ({}). '
24
+ 'This is not expected to work and may give errors. Please exit the '
25
+ 'torchvision project source and relaunch your python interpreter.')
26
+ warnings.warn(message.format(os.getcwd()))
27
+
28
_image_backend = 'PIL'
29
30
_video_backend = "pyav"
0 commit comments