-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[inductor] Make {joint_graph,inductor_prims,utils}.py pass follow_imports typechecking #113410
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
…orts typechecking [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/113410
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5156356 with merge base 4f2b288 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
… follow_imports typechecking" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler [ghstack-poisoned]
| def insertable_tensor_check(self, t: torch.Tensor) -> bool: | ||
| # TODO - we could also Tensors which get replaced with arange here | ||
| return ( | ||
| return bool( |
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.
why do we need this cast?
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.
Sounds like there is a typing bug with one of the logical and overloads. This cast would fix that issue.
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.
Tensor.all() below returns a Tensor rather than a bool. I'll move this bool cast to that line to make things clearer
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.
Right, that makes sense. Thank you for the clarification!
… follow_imports typechecking" cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler [ghstack-poisoned]
| return ( | ||
| t.numel() != 0 | ||
| and (t == t.flatten()[0]).all() | ||
| and bool((t == t.flatten()[0]).all()) |
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.
NIT
| and bool((t == t.flatten()[0]).all()) | |
| and (t == t.flatten()[0]).all().item() |
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.
Hm, looks like the bool() would be necessary anyway as item() is typed as returning Union[bool, int, float, complex]. I guess ideally we'd have generics in our Tensor type...
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.
bool is pretty much the same as item() so I think it's alright as it is
…ollow_imports typechecking (#113411) SymIntType is referenced by wrapper.py, so I added its .pyi definition. I also added SymBoolType along the way for completeness. The `insinstance` checks in wrapper.py reference torch.Type, which seems to cause mypy to choke. Not entirely sure why; I've just added type-ignore comments for now. Pull Request resolved: #113411 Approved by: https://github.com/Skylion007 ghstack dependencies: #113409, #113410
…orts typechecking (pytorch#113410) Pull Request resolved: pytorch#113410 Approved by: https://github.com/lezcano ghstack dependencies: pytorch#113409
…ollow_imports typechecking (pytorch#113411) SymIntType is referenced by wrapper.py, so I added its .pyi definition. I also added SymBoolType along the way for completeness. The `insinstance` checks in wrapper.py reference torch.Type, which seems to cause mypy to choke. Not entirely sure why; I've just added type-ignore comments for now. Pull Request resolved: pytorch#113411 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#113409, pytorch#113410
Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler