-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[jit][script] support list slicing #10318
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
| Operator("aten::add(Tensor[] a, Tensor[] b) -> Tensor[]", listAdd<Shared<TensorList>, at::Tensor>), | ||
|
|
||
| Operator( | ||
| "aten::slice(int[] l, int start, int end=9223372036854775807, int step=1) -> int[]", |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/register_prim_ops.cpp
Outdated
|
|
||
| template <typename TList, typename TElement> | ||
| Operation listSlice(Node* node) { | ||
| return [=](Stack& stack) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/register_prim_ops.cpp
Outdated
| int64_t step; | ||
|
|
||
| pop(stack, list, begin, end, step); | ||
| std::vector<TElement> sliced_list; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
apaszke
left a comment
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.
LGTM
torch/csrc/jit/script/compiler.cpp
Outdated
| // Build the input arguments | ||
| std::vector<NamedValue> args = {sliceable}; | ||
| if (sliceable.value->type()->kind() == TypeKind::DynamicType) { | ||
| // If the sliceable opject is a tensor, specify a default dimension |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
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.
michaelsuo is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: As title. Pull Request resolved: pytorch#10318 Differential Revision: D9254351 Pulled By: michaelsuo fbshipit-source-id: be891a584dc295b5e353f7f5257d64a356fb9586
Summary: As title. Pull Request resolved: pytorch#10318 Differential Revision: D9254351 Pulled By: michaelsuo fbshipit-source-id: be891a584dc295b5e353f7f5257d64a356fb9586
As title.