Skip to content

Commit

Permalink
[FBcode->GH] Move loading Decoder.so to a separate file to avoid buil…
Browse files Browse the repository at this point in the history
…ding it internally (#5183)
  • Loading branch information
prabhat00155 committed Jan 10, 2022
1 parent ffd0d23 commit d675c0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion torchvision/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import torch

from ..utils import _log_api_usage_once

try:
from ._load_gpu_decoder import _HAS_VIDEO_DECODER
except ModuleNotFoundError:
_HAS_VIDEO_DECODER = False
from ._video_opt import (
Timebase,
VideoMetaData,
_HAS_VIDEO_DECODER,
_HAS_VIDEO_OPT,
_probe_video_from_file,
_probe_video_from_memory,
Expand Down
8 changes: 8 additions & 0 deletions torchvision/io/_load_gpu_decoder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from ..extension import _load_library


try:
_load_library("Decoder")
_HAS_VIDEO_DECODER = True
except (ImportError, OSError):
_HAS_VIDEO_DECODER = False
6 changes: 0 additions & 6 deletions torchvision/io/_video_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
except (ImportError, OSError):
_HAS_VIDEO_OPT = False

try:
_load_library("Decoder")
_HAS_VIDEO_DECODER = True
except (ImportError, OSError):
_HAS_VIDEO_DECODER = False

default_timebase = Fraction(0, 1)


Expand Down

0 comments on commit d675c0c

Please sign in to comment.