-
Couldn't load subscription status.
- Fork 5.9k
implement framework of seq_pool_op and its unitest #4193
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
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]], |
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.
换成:containing 2, 3, and 2 time-steps?
X换成[7, M, N]的float tensor? 例子更通用些
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.
Done
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"; |
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.
不要使用LOG(FATAL), 用PADDLE_THROW:
PADDLE_THROW("unsupported pooling strategy");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.
Done
paddle/operators/sequence_pool_op.h Outdated
| in_g_e.device(place) = (out_g_e).broadcast(bcast); | ||
| break; | ||
| default: | ||
| LOG(FATAL) << "unsupported pooling strategy"; |
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.
same as above.
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.
Done
| AddInput("X", "Input of SequenceAvgPoolOp."); | ||
| AddOutput("Out", "The output of SequenceAvgPoolOp."); | ||
| AddInput("X", | ||
| "A float LoDTensor, the variable-length input of SequencePoolOp"); |
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.
remove float
| "A float LoDTensor, the variable-length input of SequencePoolOp"); | ||
| AddOutput( | ||
| "Out", | ||
| "A float LoDTensor, the variable-length output of SequencePoolOp."); |
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.
remove float
| 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: |
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.
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]. |
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.
and X->lod()[0] = [0, 2, 5, 7], 7 = 2 +3 + 2
| Thx @qingqing01 . I will refine doc in next PR. |
solve part1 of #4186
complete seq_sum_pool