Support complex number list in JIT#51145
Support complex number list in JIT#51145anjali411 wants to merge 9 commits intogh/anjali411/91/basefrom
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 8a9ae4c (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
SplitInfinity
left a comment
There was a problem hiding this comment.
I'm not sure if this is ready for review (I didn't check if you requested review already, oops) but there are a few distracting formatting changes, and there should be Python tests that use lists of complex numbers.
| const FunctionSchema& forward_schema = getMethod("forward").getSchema(); | ||
| std::string input_types = getSchemaInputTypesString(forward_schema); | ||
| const std::vector<Argument>& forward_args = forward_schema.arguments(); | ||
There was a problem hiding this comment.
There seem to be a lot of formatting changes below this point. Can you undo them?
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
|
@SplitInfinity ready for review. Added the python test, but can't find a way to update that file without causing those formatting changes |
[ghstack-poisoned]
[ghstack-poisoned]
| ASSERT_EQ(foo12.toComplexDouble(), c10::complex<double>(3,4)); | ||
| ASSERT_EQ(foo1.use_count(), 2); | ||
| ASSERT_TRUE(baz1.toComplexDoubleVector() == std::vector<c10::complex<double>>({(3, 4), (3, -4), (5, 0)})); | ||
| IValue the_complex_list( |
There was a problem hiding this comment.
Seems a bit weird to call this a list when it is a tuple.
There was a problem hiding this comment.
true updated the name!
| def test_complexlist(self): | ||
| def fn(a: List[complex], idx: int): | ||
| return a[idx] | ||
|
|
||
| input = [1j, 2, 3 + 4j, -5, -7j] |
There was a problem hiding this comment.
What about serialization of lists? Is that coming later?
There was a problem hiding this comment.
will add it in a follow-up PR
| bool fast_path_list = | ||
| val.isBoolList() || val.isIntList() || val.isDoubleList(); | ||
| bool fast_path_list = val.isBoolList() || val.isIntList() || | ||
| val.isDoubleList() || val.isComplexDoubleList(); |
There was a problem hiding this comment.
As I recall, complex literals are not supported in TorchScript yet, so this is not being tested.
Differential Revision: [D26154025](https://our.internmc.facebook.com/intern/diff/D26154025) [ghstack-poisoned]
Differential Revision: [D26154025](https://our.internmc.facebook.com/intern/diff/D26154025) [ghstack-poisoned]
Differential Revision: [D26154025](https://our.internmc.facebook.com/intern/diff/D26154025) [ghstack-poisoned]
|
@anjali411 merged this pull request in 508bab4. |
Summary: Pull Request resolved: pytorch#51145 Test Plan: Imported from OSS Reviewed By: SplitInfinity Differential Revision: D26154025 Pulled By: anjali411 fbshipit-source-id: 74645f9b6467757ddb9d75846e778222109848f0
Stack from ghstack:
Differential Revision: D26154025