Skip to content

Conversation

@NicolasHug
Copy link
Contributor

The main thing this PR fixes is the fact that we were calling assert_tensor_equal when checking pts or duration values. That was wrong. The reason it was wrong is that assert_tensor_equal allows for atol=2 or atol=3 on CUDA or MACOS. Calling assert_tensor_equal for checking against a PTS thus means "assert the pts is this value, plu or minus 3 seconds". That's waaaay too loose. This PR changes those checks to something stricter, and renames assert_tensor_equal into assert_frames_equal so that we know to only call that with frames.

Detailed changes:

  • rename assert_tensor_equal into assert_frames_equal
  • fix loose pts and duration checks by calling plain torch.testing.assert_close(...)
  • remove our shallow wrapper: assert_tensor_close and replace its usage (5-6 cases only, and located in a single function only) with plain torch.testing.assert_close(...).

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 2, 2024
Comment on lines +440 to +445
torch.testing.assert_close(
clip_1.pts_seconds, clip_2.pts_seconds, rtol=0, atol=0
)
torch.testing.assert_close(
clip_1.duration_seconds, clip_2.duration_seconds, rtol=0, atol=0
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example of the kind of assertions that were way too loose.

@NicolasHug NicolasHug merged commit 2bbccbf into meta-pytorch:main Dec 2, 2024
36 of 37 checks passed
@NicolasHug NicolasHug deleted the improve_test_asserts branch December 2, 2024 16:36
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants