Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions torchvision/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import warnings
import os

from .extension import _HAS_OPS

Expand All @@ -16,6 +17,14 @@
except ImportError:
pass

# Check if torchvision is being imported within the root folder
if (not _HAS_OPS and os.path.dirname(os.path.realpath(__file__)) ==
os.path.join(os.path.realpath(os.getcwd()), 'torchvision')):
message = ('You are importing torchvision within its own root folder ({}). '
'This is not expected to work and may give errors. Please exit the '
'torchvision project source and relaunch your python interpreter.')
warnings.warn(message.format(os.getcwd()))

_image_backend = 'PIL'

_video_backend = "pyav"
Expand Down