Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend SimpleVideoDecoder index-based APIs #150

Open
NicolasHug opened this issue Aug 5, 2024 · 0 comments
Open

Extend SimpleVideoDecoder index-based APIs #150

NicolasHug opened this issue Aug 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@NicolasHug
Copy link
Member

NicolasHug commented Aug 5, 2024

For consistency with tensor indexing semantics and with builtin Python indexing of sequences, we should extend the index-based APIs of SimpleVideoDecoder, namely __getitem__(), get_frame_at() and get_frames_at() to support:

  • negative indexing. -n just means len(decoder) - n.
  • upper bound in slices to be greated than len(decoder).

In short we should allow for that kind of stuff:

>>> torch.arange(10)[-3:1000]
tensor([7, 8, 9])

In terms of implementation, we can implement this within the SimpleVideoDecoder class in Python. No need to extend the core or C++ APIs.

@scotts scotts added the enhancement New feature or request label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants