-
Notifications
You must be signed in to change notification settings - Fork 25.7k
New @decorateIf decorator for param-specific conditional decoration #112033
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
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/112033
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 69831d9 with merge base 247f39f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: GraphQL query fragment PRCheckSuites on CheckSuiteConnection { fragment CommitAuthors on PullRequestCommitConnection { query ($owner: String!, $name: String!, $number: Int!) { Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…ytorch#112033) Adds a new decorator `@decorateIf(decorator, predicate_fn)`. Examples: ```python from torch.testing._internal.common_utils import decorateIf ... @decorateIf(unittest.skip, lambda params: params["x"] == 2) @parametrize("x", range(5)) def test_foo(self, x): ... @parametrize("x,y", [(1, 'foo'), (2, 'bar'), (3, 'baz')]) @decorateIf( unittest.expectedFailure, lambda params: params["x"] == 3 and params["y"] == "baz" ) def test_bar(self, x, y): ... @decorateIf( unittest.expectedFailure, lambda params: params["op"].name == "add" and params["dtype"] == torch.float16 ) @ops(op_db) def test_op_foo(self, device, dtype, op): ... @decorateIf( unittest.skip, lambda params: params["module_info"].module_cls is torch.nn.Linear and \ params["device"] == "cpu" ) @modules(module_db) def test_module_foo(self, device, dtype, module_info): ... ``` Follow-up for per-param decoration based on pytorch#79161 (comment) Pull Request resolved: pytorch#112033 Approved by: https://github.com/clee2000, https://github.com/pmeier
…ytorch#112033) Adds a new decorator `@decorateIf(decorator, predicate_fn)`. Examples: ```python from torch.testing._internal.common_utils import decorateIf ... @decorateIf(unittest.skip, lambda params: params["x"] == 2) @parametrize("x", range(5)) def test_foo(self, x): ... @parametrize("x,y", [(1, 'foo'), (2, 'bar'), (3, 'baz')]) @decorateIf( unittest.expectedFailure, lambda params: params["x"] == 3 and params["y"] == "baz" ) def test_bar(self, x, y): ... @decorateIf( unittest.expectedFailure, lambda params: params["op"].name == "add" and params["dtype"] == torch.float16 ) @ops(op_db) def test_op_foo(self, device, dtype, op): ... @decorateIf( unittest.skip, lambda params: params["module_info"].module_cls is torch.nn.Linear and \ params["device"] == "cpu" ) @modules(module_db) def test_module_foo(self, device, dtype, module_info): ... ``` Follow-up for per-param decoration based on pytorch#79161 (comment) Pull Request resolved: pytorch#112033 Approved by: https://github.com/clee2000, https://github.com/pmeier
Stack from ghstack (oldest at bottom):
Adds a new decorator
@decorateIf(decorator, predicate_fn). Examples:Follow-up for per-param decoration based on #79161 (comment)