Closed
Conversation
Summary: Pull Request resolved: pytorch#10291 This new operator will do the following: Given a LENGTHS vector and n_splits, output a "split" LENGTHS vector where: 1. Each length in input vector is split into n_splits values (thus output vector should have LENGTHS.size(0) * n_splits elements) 2. The new lengths in output should be evenly split, and if the length is not divisible by n_splits, then order new values in descending order. (e.g. n_splits = 3, length = 5 -> 2 2 1) 3. If n_splits > some element in the array, its split elements will contain 0s. (e.g. n_splits = 3, length = 2 - > 1 1 0) Differential Revision: D9013119 fbshipit-source-id: 868caaaf0cf627980928e34e4859a38f20264ede
5e3fd57 to
65f8883
Compare
Contributor
|
@pytorchbot retest this please |
bddppq
reviewed
Aug 17, 2018
|
|
||
| bool RunOnDevice() override { | ||
| const auto& L = Input(0); | ||
| CAFFE_ENFORCE(L.ndim() == 1, "Input `LENGTHS` should be a 1D vector."); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| const auto& L = Input(0); | ||
| CAFFE_ENFORCE(L.ndim() == 1, "Input `LENGTHS` should be a 1D vector."); | ||
|
|
||
| std::array<int32_t, 1> temp_params = {{n_splits_}}; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| context_.template CopyItems<Context, CPUContext>( | ||
| input1.meta(), | ||
| 1, | ||
| static_cast<const char*>(input1.raw_data()), |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| np.array([1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1])) | ||
|
|
||
| @given(**hu.gcs_cpu_only) | ||
| def test_length_split_arg(self, gc, dc): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Oscarlight
pushed a commit
to Oscarlight/pytorch
that referenced
this pull request
Sep 9, 2018
Summary: Pull Request resolved: pytorch#10974 Pull Request resolved: pytorch#10291 This new operator will do the following: Given a LENGTHS vector and n_splits, output a "split" LENGTHS vector where: 1. Each length in input vector is split into n_splits values (thus output vector should have LENGTHS.size(0) * n_splits elements) 2. The new lengths in output should be evenly split, and if the length is not divisible by n_splits, then order new values in descending order. (e.g. n_splits = 3, length = 5 -> 2 2 1) 3. If n_splits > some element in the array, its split elements will contain 0s. (e.g. n_splits = 3, length = 2 - > 1 1 0) Reviewed By: bddppq, chocjy Differential Revision: D9013119 fbshipit-source-id: ad773dcaae813c253068a7cf7e774020627f0b13
PenghuiCheng
pushed a commit
to PenghuiCheng/pytorch
that referenced
this pull request
Sep 11, 2018
Summary: Pull Request resolved: pytorch#10974 Pull Request resolved: pytorch#10291 This new operator will do the following: Given a LENGTHS vector and n_splits, output a "split" LENGTHS vector where: 1. Each length in input vector is split into n_splits values (thus output vector should have LENGTHS.size(0) * n_splits elements) 2. The new lengths in output should be evenly split, and if the length is not divisible by n_splits, then order new values in descending order. (e.g. n_splits = 3, length = 5 -> 2 2 1) 3. If n_splits > some element in the array, its split elements will contain 0s. (e.g. n_splits = 3, length = 2 - > 1 1 0) Reviewed By: bddppq, chocjy Differential Revision: D9013119 fbshipit-source-id: 82bf3371ec08c41fc3379177f0007afc142e0d84
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This new operator will do the following:
Given a LENGTHS vector and n_splits, output a "split" LENGTHS vector where:
Differential Revision: D9013119