Skip to content

Commit f3c8a05

Browse files
committed
Revert "[torchcodec] Allow sampler to use GPU decoding (#136)"
This reverts commit 33677b8.
1 parent 0be7e78 commit f3c8a05

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/torchcodec/_samplers/video_clip_sampler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class VideoTooShortException(Exception):
3131
@dataclass
3232
class DecoderArgs:
3333
num_threads: int = 0
34-
device: torch.device = torch.device("cpu")
3534

3635

3736
@dataclass
@@ -164,7 +163,6 @@ def forward(self, video_data: Tensor) -> Union[List[Any]]:
164163
width=target_width,
165164
height=target_height,
166165
num_threads=self.decoder_args.num_threads,
167-
device_string=str(self.decoder_args.device),
168166
)
169167

170168
clips: List[Any] = []

test/samplers/test_video_clip_sampler.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pytest
55
import torch
66
from torchcodec._samplers import (
7-
DecoderArgs,
87
IndexBasedSamplerArgs,
98
TimeBasedSamplerArgs,
109
VideoArgs,
@@ -31,16 +30,11 @@
3130
),
3231
],
3332
)
34-
@pytest.mark.parametrize(("device"), [torch.device("cpu"), torch.device("cuda:0")])
35-
def test_sampler(sampler_args, device):
36-
if device.type == "cuda" and not torch.cuda.is_available():
37-
pytest.skip("GPU not available")
38-
33+
def test_sampler(sampler_args):
3934
torch.manual_seed(0)
4035
desired_width, desired_height = 320, 240
4136
video_args = VideoArgs(desired_width=desired_width, desired_height=desired_height)
42-
decoder_args = DecoderArgs(device=device)
43-
sampler = VideoClipSampler(video_args, sampler_args, decoder_args)
37+
sampler = VideoClipSampler(video_args, sampler_args)
4438
clips = sampler(NASA_VIDEO.to_tensor())
4539
assert_tensor_equal(len(clips), sampler_args.clips_per_video)
4640
clip = clips[0]

0 commit comments

Comments
 (0)