-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add sym_log2 #137980
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
Add sym_log2 #137980
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/137980
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7156fa5 with merge base 60d1c71 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
# These methods call the metaprogrammed methods, they're hand written | ||
# here so we get good stack traces | ||
def abs(self) -> "SymNode": | ||
def abs(self) -> SymNode: |
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.
oops, I regret adding annotations to this file lol
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.
@ezyang, just do typing_extensions Self instead? (It's also way more future proof and doesn't require future annotations
|
||
# Methods that are only for float | ||
only_float_magic_methods = {"is_integer", "round", "sym_int"} | ||
only_float_magic_methods = {"is_integer", "round", "sym_int", "sym_log2"} |
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.
this and above only substantive changes
IsNonOverlappingAndDenseIndicator: "is_non_overlapping_and_dense_indicator", | ||
RoundDecimal: "round_decimal", | ||
# TODO: do the rest of the opaque unary functions... | ||
OpaqueUnaryFn_log2: "log2", |
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.
I thought someone had to do this and Sympy and they do for codegen: https://github.com/sympy/sympy/blob/b4ce69ad5d40e4e545614b6c76ca9b0be0b98f0b/sympy/codegen/cfunctions.py#L224-L281 Not sure if it's useful here though
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.
I don't want to use the sympy functions because they are too smart and try to do simplifications but I don't want simplifications I want my float functions as is NO fancypants
if a is -int_oo: | ||
a = -sympy.oo | ||
if name == "log2": | ||
return sympy.log(a, 2) |
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.
Can we generalize this to any standard log base?
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.
I guess... lol
@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 |
@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 |
@pytorchbot revert -m "lint broke from this onwards on main" -c landrace |
@pytorchbot successfully started a revert job. Check the current status here. |
@ezyang your PR has been successfully reverted. |
This reverts commit 5d450d7. Reverted #137980 on behalf of https://github.com/jeanschmidt due to lint broke from this onwards on main ([comment](#137980 (comment)))
@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 |
Stack from ghstack (oldest at bottom):
Internal xref: https://fb.workplace.com/groups/1075192433118967/permalink/1515595595745313/
Signed-off-by: Edward Z. Yang ezyang@meta.com
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10