def METHOD_NAME(videos: t.List[Video], sampler, transforms) -> torch.Tensor:
    trans_results = []
    for video in videos:
        with tempfile.NamedTemporaryFile() as f:
            f.write(video.to_bytes())
            f.flush()
            cap = cv2.VideoCapture(f.name)
            ids = sampler.sampling(range_max=int(cap.get(cv2.CAP_PROP_FRAME_COUNT)))
            frames = []
            pre_idx = max(ids)
            for idx in ids:
                if pre_idx != (idx - 1):
                    cap.set(cv2.CAP_PROP_POS_FRAMES, idx)
                res, frame = cap.read()  # in BGR/GRAY format
                pre_idx = idx
                if len(frame.shape) < 3:
                    # Convert Gray to RGB
                    frame = cv2.cvtColor(frame, cv2.COLOR_GRAY2RGB)
                else:
                    # Convert BGR to RGB
                    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
                frames.append(frame)
            clip_input = np.concatenate(frames, axis=2)
            trans_results.append(transforms(clip_input))
    return (
        torch.stack(trans_results).float().cuda()
        if torch.cuda.is_available()
        else torch.stack(trans_results).float().cpu()
    )