Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
datumbox authored Feb 27, 2022
2 parents bbb9016 + 1fc53b2 commit 2af4162
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/test_video_gpu_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest
import torch
from torchvision.io import _HAS_VIDEO_DECODER, VideoReader
from torchvision.io import _HAS_GPU_VIDEO_DECODER, VideoReader

try:
import av
Expand All @@ -13,7 +13,7 @@
VIDEO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "videos")


@pytest.mark.skipif(_HAS_VIDEO_DECODER is False, reason="Didn't compile with support for gpu decoder")
@pytest.mark.skipif(_HAS_GPU_VIDEO_DECODER is False, reason="Didn't compile with support for gpu decoder")
class TestVideoGPUDecoder:
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
@pytest.mark.parametrize(
Expand Down
8 changes: 4 additions & 4 deletions torchvision/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from ..utils import _log_api_usage_once

try:
from ._load_gpu_decoder import _HAS_VIDEO_DECODER
from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER
except ModuleNotFoundError:
_HAS_VIDEO_DECODER = False
_HAS_GPU_VIDEO_DECODER = False
from ._video_opt import (
Timebase,
VideoMetaData,
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(self, path: str, stream: str = "video", num_threads: int = 0, devic
self.is_cuda = False
device = torch.device(device)
if device.type == "cuda":
if not _HAS_VIDEO_DECODER:
if not _HAS_GPU_VIDEO_DECODER:
raise RuntimeError("Not compiled with GPU decoder support.")
self.is_cuda = True
if device.index is None:
Expand Down Expand Up @@ -218,7 +218,7 @@ def set_current_stream(self, stream: str) -> bool:
"_read_video_timestamps_from_memory",
"_probe_video_from_memory",
"_HAS_VIDEO_OPT",
"_HAS_VIDEO_DECODER",
"_HAS_GPU_VIDEO_DECODER",
"_read_video_clip_from_memory",
"_read_video_meta_data",
"VideoMetaData",
Expand Down
4 changes: 2 additions & 2 deletions torchvision/io/_load_gpu_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

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

0 comments on commit 2af4162

Please sign in to comment.