-
Notifications
You must be signed in to change notification settings - Fork 27.7k
Create a mechanism to trigger tests that only warn once #47624
Copy link
Copy link
Closed
Labels
function requestA request for a new function or the addition of new arguments/modes to an existing function.A request for a new function or the addition of new arguments/modes to an existing function.high prioritymodule: testsIssues related to tests (not the torch.testing module)Issues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
function requestA request for a new function or the addition of new arguments/modes to an existing function.A request for a new function or the addition of new arguments/modes to an existing function.high prioritymodule: testsIssues related to tests (not the torch.testing module)Issues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Today in PyTorch we have TORCH_WARN and TORCH_WARN_ONCE. TORCH_WARN_ONCE, as its name suggests, only throws a warning one time. This makes it tricky to test for. Our test suite, for example, has maybeWarnsRegex, but this just verifies that no other warnings are thrown.
This feature request is for a mechanism to consistently trigger warnings that use TORCH_WARN_ONCE. One mechanism for this would be to add a new context that, if set, causes these warnings to always warn. This would let us reliably test that these warnings are thrown correctly.
cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @mruberry @VitalyFedyunin @walterddr