Skip to content

Commit 1fc53b2

Browse files
authored
Update attribute name for readability (#5484)
1 parent bb83e5b commit 1fc53b2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

test/test_video_gpu_decoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
import torch
6-
from torchvision.io import _HAS_VIDEO_DECODER, VideoReader
6+
from torchvision.io import _HAS_GPU_VIDEO_DECODER, VideoReader
77

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

1515

16-
@pytest.mark.skipif(_HAS_VIDEO_DECODER is False, reason="Didn't compile with support for gpu decoder")
16+
@pytest.mark.skipif(_HAS_GPU_VIDEO_DECODER is False, reason="Didn't compile with support for gpu decoder")
1717
class TestVideoGPUDecoder:
1818
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
1919
@pytest.mark.parametrize(

torchvision/io/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from ..utils import _log_api_usage_once
66

77
try:
8-
from ._load_gpu_decoder import _HAS_VIDEO_DECODER
8+
from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER
99
except ModuleNotFoundError:
10-
_HAS_VIDEO_DECODER = False
10+
_HAS_GPU_VIDEO_DECODER = False
1111
from ._video_opt import (
1212
Timebase,
1313
VideoMetaData,
@@ -119,7 +119,7 @@ def __init__(self, path: str, stream: str = "video", num_threads: int = 0, devic
119119
self.is_cuda = False
120120
device = torch.device(device)
121121
if device.type == "cuda":
122-
if not _HAS_VIDEO_DECODER:
122+
if not _HAS_GPU_VIDEO_DECODER:
123123
raise RuntimeError("Not compiled with GPU decoder support.")
124124
self.is_cuda = True
125125
if device.index is None:
@@ -218,7 +218,7 @@ def set_current_stream(self, stream: str) -> bool:
218218
"_read_video_timestamps_from_memory",
219219
"_probe_video_from_memory",
220220
"_HAS_VIDEO_OPT",
221-
"_HAS_VIDEO_DECODER",
221+
"_HAS_GPU_VIDEO_DECODER",
222222
"_read_video_clip_from_memory",
223223
"_read_video_meta_data",
224224
"VideoMetaData",

torchvision/io/_load_gpu_decoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
try:
55
_load_library("Decoder")
6-
_HAS_VIDEO_DECODER = True
6+
_HAS_GPU_VIDEO_DECODER = True
77
except (ImportError, OSError):
8-
_HAS_VIDEO_DECODER = False
8+
_HAS_GPU_VIDEO_DECODER = False

0 commit comments

Comments
 (0)