Skip to content

Conversation

@isuruf
Copy link
Collaborator

@isuruf isuruf commented Sep 13, 2024

Stack from ghstack (oldest at bottom):

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 13, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/135999

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit a097c35 with merge base 7647c39 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
@isuruf isuruf requested a review from ezyang September 13, 2024 15:05
try:
return sympy.expand(r)
return fast_expand(r)
except RecursionError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw it might be OK to remove the hasattr/RecursionError guarding with the change now, if it's now trivially obvious we won't blow out the stack expanding with the new code

IndicatorTypes = (IsNonOverlappingAndDenseIndicator,)


def _expandsums(args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least a teeny type signature would be nice lol

for add in adds:
result = [a * b for a, b in itertools.product(result, add.args)]

result = sympy.Add(*result)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do make_args I guess, since we have to combine common terms

# checks when re-creating objects.
new_args = [fast_expand(arg) for arg in expr.args]
if any(arg is not new_arg for arg, new_arg in zip(expr.args, new_args)):
return fast_expand(expr.func(*new_args))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, RecursionError danger here, I guess

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. However I'm not sure if replacing this line with expr = expr.func(*new_args) would work.

if exp > 1:
return sympy.expand_multinomial(expr, deep=False)
elif exp < 0:
return 1 / sympy.expand_multinomial(1 / expr, deep=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is impossible, because I added a FloatPow for this case

[ghstack-poisoned]
isuruf added a commit that referenced this pull request Sep 13, 2024
ghstack-source-id: f757748
Pull Request resolved: #135999
@ezyang
Copy link
Contributor

ezyang commented Sep 14, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 14, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: fx release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants