implement framework of seq_pool_op and its unitest#4193
Merged
luotao1 merged 3 commits intoPaddlePaddle:developfrom Sep 25, 2017
luotao1:seq_pool
Merged
implement framework of seq_pool_op and its unitest#4193luotao1 merged 3 commits intoPaddlePaddle:developfrom luotao1:seq_pool
luotao1 merged 3 commits intoPaddlePaddle:developfrom
luotao1:seq_pool
Conversation
qingqing01
reviewed
Sep 21, 2017
paddle/operators/sequence_pool_op.cc
Outdated
|
|
||
| For a mini-batch of 3 variable lengths sentences, containing 2, 3, and 2 words: | ||
|
|
||
| X = [[1, 3], [2, 4, 6], [5, 1]], |
Contributor
There was a problem hiding this comment.
换成:containing 2, 3, and 2 time-steps?
X换成[7, M, N]的float tensor? 例子更通用些
paddle/operators/sequence_pool_op.h
Outdated
| out_e.device(place) = in_e.sum(Eigen::array<int, 1>({{0}})); | ||
| break; | ||
| default: | ||
| LOG(FATAL) << "unsupported pooling strategy"; |
Contributor
There was a problem hiding this comment.
不要使用LOG(FATAL), 用PADDLE_THROW:
PADDLE_THROW("unsupported pooling strategy");
paddle/operators/sequence_pool_op.h
Outdated
| in_g_e.device(place) = (out_g_e).broadcast(bcast); | ||
| break; | ||
| default: | ||
| LOG(FATAL) << "unsupported pooling strategy"; |
qingqing01
approved these changes
Sep 25, 2017
| AddInput("X", "Input of SequenceAvgPoolOp."); | ||
| AddOutput("Out", "The output of SequenceAvgPoolOp."); | ||
| AddInput("X", | ||
| "A float LoDTensor, the variable-length input of SequencePoolOp"); |
| "A float LoDTensor, the variable-length input of SequencePoolOp"); | ||
| AddOutput( | ||
| "Out", | ||
| "A float LoDTensor, the variable-length output of SequencePoolOp."); |
| More detailed comments will be added later. | ||
| SequencePoolOp pools features of all time-steps of each instance. | ||
|
|
||
| For a mini-batch of 3 variable lengths sentences, containing 2, 3, and 2 time-steps: |
Contributor
There was a problem hiding this comment.
variable-length sentences
|
|
||
| For a mini-batch of 3 variable lengths sentences, containing 2, 3, and 2 time-steps: | ||
|
|
||
| Assume X is a [7,M,N] float LoDTensor, and X->lod()[0] = [0, 2, 5, 7]. |
Contributor
There was a problem hiding this comment.
and X->lod()[0] = [0, 2, 5, 7], 7 = 2 +3 + 2
Contributor
Author
|
Thx @qingqing01 . I will refine doc in next PR. |
6 tasks
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.
solve part1 of #4186
complete seq_sum_pool