-
Notifications
You must be signed in to change notification settings - Fork 25.7k
TST Adds __repr__ and str to module info #63737
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
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 04b0694 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
Codecov Report
@@ Coverage Diff @@
## master #63737 +/- ##
==========================================
+ Coverage 58.96% 65.16% +6.19%
==========================================
Files 705 705
Lines 92166 92222 +56
==========================================
+ Hits 54347 60094 +5747
+ Misses 37819 32128 -5691 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! Test logic checks out, although this does bring up a tradeoff between test time and test granularity. That is, the __repr__() / str() tests could be merged into another set of tests to avoid the additional overhead of module instantiation. For now, I like this better since it's more modular, and we can look into merging if necessary later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Mind doing a quick rebase?
|
@jbschlosser has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
@jbschlosser merged this pull request in 50067c0. |
| module_inputs = module_info.module_inputs_func(module_info, device=device, dtype=dtype, | ||
| requires_grad=False) | ||
| for module_input in module_inputs: | ||
| args, kwargs = module_input.constructor_input.args, module_input.constructor_input.kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by fyi: one thing to be considerate of in the overall design of ModuleInfo testing is test time. I'm not sure how long running through all the modules and their inputs takes but it might makes sense to glom multiple tests together to avoid having to do it so often
| @modules(module_db) | ||
| def test_repr(self, device, dtype, module_info): | ||
| # Test module can be represented with repr and str without errors. | ||
| module_cls = module_info.module_cls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this pattern common enough that it's worth abstracting it?
Follow up to #61935
This PR adds
test_reprtotest_modules.cc @albanD @mruberry @jbschlosser @walterddr