-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Finish math tests once and for all (hopefully) #22481
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
Added similar logic to __init__.py Formatting Added compatibility for python2 gh-metadata: pytorch pytorch 21511 gh/chillee/35/head
gh-metadata: pytorch pytorch 21512 gh/chillee/36/head
| return x | ||
|
|
||
|
|
||
| unimplemented_math_ops = ["fsum", "isclose", "trunc"] |
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 it intended to make unimplemented_math_ops available in torch.jit namespace? This is user facing, why do we want this?
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.
The goal was to not duplicate the list across __init__ and test_jit: #21511 (comment)
Is there another namespace I can put this in?
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'm not sure if there's another namespace hmmm, I commented below to check if this behavior is expected or not.
| _builtin_table[id(math.isfinite)] = "aten::isfinite" | ||
| math_ops = [x for x in dir(math) if callable(getattr(math, x))] | ||
| special_math_ops = ["remainder"] # We bind this to aten::mathremainder | ||
| for op in math_ops: |
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 sustainable? IIUC say if python3.8 add math.xxx in math module, this might fail?
This also implies number of math ops we support in torchscript varies based on the python version it's compiled with right? e.g. math.xxx is available in python2 but not python3, then it's only registered in torchscript in the python2 build.
cc: @driazati is this behavior expected?
A combination of #21511 and #21512 that also fixes the
test_unsupported_builtin_errortest.