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
[jit] allow slicing multiple dimensions with indices #45239
Conversation
[ghstack-poisoned]
ghstack-source-id: 9fd59f36c81182b82a2684cd2b53a928336579b5 Pull Request resolved: #45239
test/jit/test_list_dict.py
Outdated
x = x[[0, 1], :, [1]] | ||
return x | ||
|
||
test_func(test_index_slice1, (a,)) |
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.
You can use self.checkScript for same functionality.
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.
Ah, I didn't use that because I wasn't sure if it was comparing the outputs of the scripted vs non-scripted modules. I double checked on the self.checkScript code and I see that it actually does. I'll change it to use that instead :)
💊 CI failures summary and remediationsAs of commit 0c84b75 (more details on the Dr. CI page): Commit 0c84b75 was recently pushed. Waiting for builds... 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 on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 13 times. |
Differential Revision: [D23886919](https://our.internmc.facebook.com/intern/diff/D23886919) [ghstack-poisoned]
Currently investigating issue where indexing with an empty list in eager returns a tensor with a zero-sized dim in the empty list spot *OTOH* the scripted module will throw this error: " RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript (most recent call last): RuntimeError: Input must be of ints, floats, or bools, got Tensor Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2) " ghstack-source-id: 5f830201f21d626dadef63a9c1677cd90e5078d3 Pull Request resolved: #45239
Currently investigating issue where indexing with an empty list in eager returns a tensor with a zero-sized dim in the empty list spot *OTOH* the scripted module will throw this error: " RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript (most recent call last): RuntimeError: Input must be of ints, floats, or bools, got Tensor Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2) " Differential Revision: [D23886919](https://our.internmc.facebook.com/intern/diff/D23886919) [ghstack-poisoned]
Currently investigating issue where indexing with an empty list in eager returns a tensor with a zero-sized dim in the empty list spot *OTOH* the scripted module will throw this error: " RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript (most recent call last): RuntimeError: Input must be of ints, floats, or bools, got Tensor Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2) " Differential Revision: [D23886919](https://our.internmc.facebook.com/intern/diff/D23886919) [ghstack-poisoned]
Currently investigating issue where indexing with an empty list in eager returns a tensor with a zero-sized dim in the empty list spot *OTOH* the scripted module will throw this error: " RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript (most recent call last): RuntimeError: Input must be of ints, floats, or bools, got Tensor Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2) " ghstack-source-id: 10c0d1a8d164e9dfe8b1ec6a008782d98388a309 Pull Request resolved: #45239
test/jit/test_list_dict.py
Outdated
x = x[[], :, :] | ||
return x | ||
|
||
self.checkScript(test_index_slice1, (a,)) |
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.
Move check right next to its function under test, ideally all of them should become individual small testcases
test/jit/test_list_dict.py
Outdated
with self.assertRaisesRegex(RuntimeError, "index 4 is out of bounds for dimension 0 with size 3"): | ||
self.checkScript(test_index_slice4, (a,)) | ||
|
||
with self.assertRaises(RuntimeError): |
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 think this test case is needed, please make sure empty sequence with torch.jit.annotate works.
Differential Revision: [D23886919](https://our.internmc.facebook.com/intern/diff/D23886919) [ghstack-poisoned]
Currently investigating issue where indexing with an empty list in eager returns a tensor with a zero-sized dim in the empty list spot *OTOH* the scripted module will throw this error: " RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript (most recent call last): RuntimeError: Input must be of ints, floats, or bools, got Tensor Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2) " ghstack-source-id: 970d1d69827fbbb7e62aa5ab3d071cc399b8997b Pull Request resolved: #45239
Stack from ghstack:
Differential Revision: D23886919