-
Notifications
You must be signed in to change notification settings - Fork 25k
[TS] Add complex support for more ops #54541
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]
💊 CI failures summary and remediationsAs of commit 3516612 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
[ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
DEFINE_SCALAR_SCALAR_BINARY_OP( | ||
DEFINE_INT_COMPLEX_OP(aten::log, std::log(a) / std::log(b), complex), | ||
DEFINE_FLOAT_COMPLEX_OP(aten::log, std::log(a) / std::log(b), complex), | ||
DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX( |
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.
DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX( | |
DEFINE_SCALAR_SCALAR_BINARY_OP_WITH_COMPLEX( |
As discussed this should probably be DEFINE_SCALAR_SCALAR_BINARY_OP_WITH_COMPLEX
to avoid naming conflicts with aten::log
for tensors.
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
TODO: add tests [ghstack-poisoned]
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.
Just some nits and one or two questions.
Differential Revision: [D27599114](https://our.internmc.facebook.com/intern/diff/D27599114) [ghstack-poisoned]
Differential Revision: [D27599114](https://our.internmc.facebook.com/intern/diff/D27599114) [ghstack-poisoned]
Differential Revision: [D27599114](https://our.internmc.facebook.com/intern/diff/D27599114) [ghstack-poisoned]
Differential Revision: [D27599114](https://our.internmc.facebook.com/intern/diff/D27599114) [ghstack-poisoned]
Differential Revision: [D27599114](https://our.internmc.facebook.com/intern/diff/D27599114) [ghstack-poisoned]
test/jit/test_complex.py
Outdated
def fn5(a: complex, b: int): | ||
return a == b | ||
def fn6(a: complex, b: int): | ||
return a != b | ||
|
||
with self.assertRaises(RuntimeError): | ||
self.checkScript(fn5, (x1, 1)) | ||
with self.assertRaises(RuntimeError): | ||
self.checkScript(fn6, (x1, 1)) | ||
|
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 have these tests been removed? I think I commented about them earlier and that's why you added them?
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 I saw an AddressSanitizer
failure on just ASAN after I added them. Just wanted to verify if that was it.
@@ -99,7 +106,7 @@ def checkCmath(func_name, funcs_template=funcs_template): | |||
self.assertEqual(res_python, res_script, msg=msg) | |||
|
|||
unary_ops = ['log', 'log10', 'sqrt', 'exp', 'sin', 'cos', 'asin', 'acos', 'atan', 'sinh', 'cosh', | |||
'tanh', 'asinh', 'acosh', 'atanh', 'phase'] | |||
'tanh', 'asinh', 'acosh', 'atanh', 'phase', 'isinf', 'isnan', 'isfinite'] | |||
|
|||
# --- Unary ops --- | |||
for op in unary_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.
One cool thing I learned about recently: https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests
Using with self.subTest(op):
here might make it clear which specific test being generated within this one test is failing.
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.
wow looks super useful!
def pow_float_complex(x: float, y: complex): | ||
return pow(x, y) | ||
|
||
|
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.
@@ -120,7 +153,6 @@ def func(): | |||
for x in (float_consts + complex_consts): | |||
checkCmath(x, funcs_template=func_constants_template) | |||
|
|||
|
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.
Remove
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 noticed you got rid of tests that we added specifically because we were missing coverage for invalid comparisons between int and complex (or something like that). Can you comment on that?
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.
Ok approving but I strongly strongly recommend trying to add those tests in a follow up diff. They're not super valuable by themselves but the error logs from the failure make me think that they might have triggered a real issue that we should look into and fix.
@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@anjali411 merged this pull request in 82d7149. |
Summary: Pull Request resolved: pytorch#54541 Test Plan: Imported from OSS Reviewed By: SplitInfinity Differential Revision: D27599114 Pulled By: anjali411 fbshipit-source-id: 182d4480fd788599c408bfaf0d23baf3d9a4e967
Stack from ghstack:
Differential Revision: D27599114