Skip to content
Closed
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
10 changes: 5 additions & 5 deletions benchmarks/decoders/gpu_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import torch.utils.benchmark as benchmark

import torchcodec
from torchvision.transforms import Resize
import torchvision.transforms.v2.functional as F

RESIZED_WIDTH = 256
RESIZED_HEIGHT = 256


def transfer_and_resize_frame(frame, resize_device_string):
# This should be a no-op if the frame is already on the GPU.
# This should be a no-op if the frame is already on the target device.
frame = frame.to(resize_device_string)
frame = Resize((RESIZED_HEIGHT, RESIZED_WIDTH))(frame)
frame = F.resize(frame, (RESIZED_HEIGHT, RESIZED_WIDTH))
return frame


Expand Down Expand Up @@ -129,8 +129,8 @@ def main():
"resize_device_string": resize_device_string,
},
label=label,
sub_label=f"video={os.path.basename(video_path)}",
description=f"D={decode_label},R={resize_label}",
description=f"video={os.path.basename(video_path)}",
sub_label=f"D={decode_label} R={resize_label}",
).blocked_autorange()
results.append(t)
compare = benchmark.Compare(results)
Expand Down