Skip to content
Merged
Show file tree
Hide file tree
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
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