-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
stride pooling for max and average layer #2701
Conversation
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.
Almost LGTM. Only need to refine the comments.
paddle/gserver/layers/MaxLayer.h
Outdated
@@ -26,6 +26,11 @@ namespace paddle { | |||
* If SequenceLevel = kNonSeq: | |||
* Output: output size is the number of input sequences (NOT input instances) | |||
* output[i] = max_{for each instance in this sequence}{input[i]} | |||
* If stride_ > 0: | |||
* Output: a shorten sequence. The operation of getting max instance of a | |||
* sequence is independently performed on every slice of the input |
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.
- “getting max instance of a sequence” 这个表述令人困惑。
- Stride is the step size by which we slide a window upon the input sequence, and the pooling operation is then applied to each interval independently.
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. And update the comments in SequencePoolLayer.h, AverageLayer.h and SequenceLastInstanceLayer.h at the same time.
@@ -1112,6 +1118,8 @@ def pooling_layer(input, | |||
:param pooling_type: Type of pooling, MaxPooling(default), AvgPooling, | |||
SumPooling, SquareRootNPooling. | |||
:type pooling_type: BasePoolingType|None | |||
:param stride: window size. |
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.
stride --> the step size between successive pooling regions.
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, and update the comments in last_seq and first_seq at the same time.
If stride > 0, this layer slides a window whose size is determined by stride, | ||
and return the pooling value of the window as the output. Thus, a long sequence | ||
will be shorten. Note that for sequence with sub-sequence, the default value | ||
of stride is -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.
the parameter stride specifies the intervals at which to apply the pooling operation.
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
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.
@lcy-seso finish updating the comments. Please review again, thx!
If stride > 0, this layer slides a window whose size is determined by stride, | ||
and return the pooling value of the window as the output. Thus, a long sequence | ||
will be shorten. Note that for sequence with sub-sequence, the default value | ||
of stride is -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.
Done
@@ -1112,6 +1118,8 @@ def pooling_layer(input, | |||
:param pooling_type: Type of pooling, MaxPooling(default), AvgPooling, | |||
SumPooling, SquareRootNPooling. | |||
:type pooling_type: BasePoolingType|None | |||
:param stride: window size. |
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, and update the comments in last_seq and first_seq at the same time.
paddle/gserver/layers/MaxLayer.h
Outdated
@@ -26,6 +26,11 @@ namespace paddle { | |||
* If SequenceLevel = kNonSeq: | |||
* Output: output size is the number of input sequences (NOT input instances) | |||
* output[i] = max_{for each instance in this sequence}{input[i]} | |||
* If stride_ > 0: | |||
* Output: a shorten sequence. The operation of getting max instance of a | |||
* sequence is independently performed on every slice of the input |
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. And update the comments in SequencePoolLayer.h, AverageLayer.h and SequenceLastInstanceLayer.h at the same time.
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
fix #1608.
finish feature of "Sequence Pooling with Stride".