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

[torchcodec] refactor test utils to be based around dataclasses #57

Closed
wants to merge 1 commit into from
Closed

[torchcodec] refactor test utils to be based around dataclasses #57

wants to merge 1 commit into from

Conversation

scotts
Copy link
Contributor

@scotts scotts commented Jun 28, 2024

Summary:
Refactors our testing utilities to consider the actual reference file to be a first-class concept by making it an object, and then all operations we do are on that object. Some principles I was trying to keep:

  1. There should be one clear definition of a reference media file, with all of its important parameters in one place with names that have obvious semantic meaning.
  2. Operations that are conceptually connected to a reference media file should be methods on that object.
  3. Tests should only have to use the object defined in 1.
  4. Formalize the patterns we've already established in how we name reference files.
  5. Make adding new reference files easy and obvious.

Right now, we can only support reference tensors by timestamp with a generic approach. I think we should try to make that more an explicit pattern based on the pts value, but I'm not sure exactly how to do that right now. That will probably require changing some of our current reference file names.

Also in the future, the reference file generation should probably use these definitions as well. That will ensure we keep everything consistent.

Differential Revision: D59161329

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 28, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59161329

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59161329

3 similar comments
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59161329

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59161329

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59161329

Summary:
Pull Request resolved: #57

Refactors our testing utilities to consider the actual reference file to be a first-class concept by making it an object, and then all operations we do are on that object. Some principles I was trying to keep:

1. There should be one clear definition of a reference media file, with all of its important parameters in one place with names that have obvious semantic meaning.
2. Operations that are conceptually connected to a reference media file should be methods on that object.
3. Tests should only have to use the object defined in 1.
4. Formalize the patterns we've already established in how we name reference files.
5. Make adding new reference files easy and obvious.

Right now, we can only support reference tensors by timestamp with a generic approach. I think we should try to make that more an explicit pattern based on the pts value, but I'm not sure exactly how to do that right now. That will probably require changing some of our current reference file names.

This diff also addresses the awkwardness in how we numbered our reference frames: the first 10 frames used to be 1-index based, and the rest 0-index based. This diff makes all frames 0-index based.

Also in the future, the reference file *generation* should probably use these definitions as well. That will ensure we keep everything consistent.

Differential Revision: D59161329
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59161329

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 7af94c7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants