Skip to content

Commit

Permalink
[bugfix] Correct valid frame sample check in LambdaSampler
Browse files Browse the repository at this point in the history
  • Loading branch information
willprice committed Jan 27, 2020
1 parent 24e6d32 commit 15d65be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/torchvideo/samplers.py
Expand Up @@ -252,7 +252,8 @@ def __init__(self, sampler: Callable[[int], Union[slice, List[slice], List[int]]

def sample(self, video_length: int) -> Union[slice, List[int], List[slice]]:
frame_idx = self._fn(video_length)
if not all([i < (video_length - 1) for i in frame_idx_to_list(frame_idx)]):
frame_idx_list = frame_idx_to_list(frame_idx)
if not all([i < video_length for i in frame_idx_list]):
raise ValueError(
"Invalid frame_idx {} from user provided sampler for video of "
"length {}".format(frame_idx, video_length)
Expand Down

0 comments on commit 15d65be

Please sign in to comment.