Skip to content

Commit

Permalink
Improve io.videoreader pyav backend performance (#8173)
Browse files Browse the repository at this point in the history
  • Loading branch information
imagazin-intel authored Dec 20, 2023
1 parent ffc58ef commit 6640e49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchvision/io/video_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def __next__(self) -> Dict[str, Any]:
frame = next(self._c)
pts = float(frame.pts * frame.time_base)
if "video" in self.pyav_stream:
frame = torch.tensor(frame.to_rgb().to_ndarray()).permute(2, 0, 1)
frame = torch.as_tensor(frame.to_rgb().to_ndarray()).permute(2, 0, 1)
elif "audio" in self.pyav_stream:
frame = torch.tensor(frame.to_ndarray()).permute(1, 0)
frame = torch.as_tensor(frame.to_ndarray()).permute(1, 0)
else:
frame = None
except av.error.EOFError:
Expand Down

0 comments on commit 6640e49

Please sign in to comment.