-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[optim] abstract out _default_to_foreach_util #92305
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/92305
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7d3259a: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
albanD
left a comment
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.
SGTM
|
@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 |
| all_tensors = [] | ||
| for tensorlist in tensorlists: | ||
| all_tensors.extend(tensorlist) | ||
| return not torch.jit.is_scripting() and not differentiable and 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.
These booleans have nothing to do with iterating over the list, can we have it be an early return before the all_tensor list is even constructed?
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.
On 2nd thought, this isn't perf critical so fine as is.
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.
haha appreciate the perf-oriented mindset! since this is so close to landing, i'll leave it for now but will update in a later PR.
Stack from ghstack (oldest at bottom):