Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
1fc53b28
Unverified
Commit
1fc53b28
authored
Feb 25, 2022
by
Prabhat Roy
Committed by
GitHub
Feb 25, 2022
Browse files
Update attribute name for readability (#5484)
parent
bb83e5b5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
test/test_video_gpu_decoder.py
test/test_video_gpu_decoder.py
+2
-2
torchvision/io/__init__.py
torchvision/io/__init__.py
+4
-4
torchvision/io/_load_gpu_decoder.py
torchvision/io/_load_gpu_decoder.py
+2
-2
No files found.
test/test_video_gpu_decoder.py
View file @
1fc53b28
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
import
pytest
import
pytest
import
torch
import
torch
from
torchvision.io
import
_HAS_VIDEO_DECODER
,
VideoReader
from
torchvision.io
import
_HAS_
GPU_
VIDEO_DECODER
,
VideoReader
try
:
try
:
import
av
import
av
...
@@ -13,7 +13,7 @@ except ImportError:
...
@@ -13,7 +13,7 @@ except ImportError:
VIDEO_DIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"assets"
,
"videos"
)
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
:
class
TestVideoGPUDecoder
:
@
pytest
.
mark
.
skipif
(
av
is
None
,
reason
=
"PyAV unavailable"
)
@
pytest
.
mark
.
skipif
(
av
is
None
,
reason
=
"PyAV unavailable"
)
@
pytest
.
mark
.
parametrize
(
@
pytest
.
mark
.
parametrize
(
...
...
torchvision/io/__init__.py
View file @
1fc53b28
...
@@ -5,9 +5,9 @@ import torch
...
@@ -5,9 +5,9 @@ import torch
from
..utils
import
_log_api_usage_once
from
..utils
import
_log_api_usage_once
try
:
try
:
from
._load_gpu_decoder
import
_HAS_VIDEO_DECODER
from
._load_gpu_decoder
import
_HAS_
GPU_
VIDEO_DECODER
except
ModuleNotFoundError
:
except
ModuleNotFoundError
:
_HAS_VIDEO_DECODER
=
False
_HAS_
GPU_
VIDEO_DECODER
=
False
from
._video_opt
import
(
from
._video_opt
import
(
Timebase
,
Timebase
,
VideoMetaData
,
VideoMetaData
,
...
@@ -119,7 +119,7 @@ class VideoReader:
...
@@ -119,7 +119,7 @@ class VideoReader:
self
.
is_cuda
=
False
self
.
is_cuda
=
False
device
=
torch
.
device
(
device
)
device
=
torch
.
device
(
device
)
if
device
.
type
==
"cuda"
:
if
device
.
type
==
"cuda"
:
if
not
_HAS_VIDEO_DECODER
:
if
not
_HAS_
GPU_
VIDEO_DECODER
:
raise
RuntimeError
(
"Not compiled with GPU decoder support."
)
raise
RuntimeError
(
"Not compiled with GPU decoder support."
)
self
.
is_cuda
=
True
self
.
is_cuda
=
True
if
device
.
index
is
None
:
if
device
.
index
is
None
:
...
@@ -218,7 +218,7 @@ __all__ = [
...
@@ -218,7 +218,7 @@ __all__ = [
"_read_video_timestamps_from_memory"
,
"_read_video_timestamps_from_memory"
,
"_probe_video_from_memory"
,
"_probe_video_from_memory"
,
"_HAS_VIDEO_OPT"
,
"_HAS_VIDEO_OPT"
,
"_HAS_VIDEO_DECODER"
,
"_HAS_
GPU_
VIDEO_DECODER"
,
"_read_video_clip_from_memory"
,
"_read_video_clip_from_memory"
,
"_read_video_meta_data"
,
"_read_video_meta_data"
,
"VideoMetaData"
,
"VideoMetaData"
,
...
...
torchvision/io/_load_gpu_decoder.py
View file @
1fc53b28
...
@@ -3,6 +3,6 @@ from ..extension import _load_library
...
@@ -3,6 +3,6 @@ from ..extension import _load_library
try
:
try
:
_load_library
(
"Decoder"
)
_load_library
(
"Decoder"
)
_HAS_VIDEO_DECODER
=
True
_HAS_
GPU_
VIDEO_DECODER
=
True
except
(
ImportError
,
OSError
):
except
(
ImportError
,
OSError
):
_HAS_VIDEO_DECODER
=
False
_HAS_
GPU_
VIDEO_DECODER
=
False
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment