meta-pytorch / meta-pytorch/torchcodec

Investigate refactoring how we return AVIOFileLikeContext

Open
#896 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactor
Dominant language
Python
Stars
1.2k
Forks
125
Avg merge
22h 47m
Merged PRs (30d)
54

Description

PR #889 refactored how we create decoders that take a file-like object. See the PR for full details. The state the code was left in, though, still has a not-great quirk that we're doing this:

  1. C++ creates object in pybind_ops.cpp, does a reinterpret_cast<int64_t> and returns that value to Python layer.
  2. Python layer accepts the int and forwards that int decoder creation in custom_ops.cpp.
  3. C++ in custom_ops.cpp does a reinterpet_cast<AVIOFileLikeContext*> on the int.

That's not great. The purpose of this issue is to investigate if defining an actual pybind object that wraps AVIOFileLikeContext is better.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PR #889 for the existing decoder refactor, then trace AVIOFileLikeContext through pybind_ops.cpp and custom_ops.cpp. Investigate whether a pybind object can wrap the context instead of passing a cast integer, and document the viable approach and its implications as the outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.