Skip to content
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

Merged
merged 4 commits into from
Jul 5, 2017
Merged

stride pooling for max and average layer #2701

merged 4 commits into from
Jul 5, 2017

Conversation

luotao1
Copy link
Contributor

@luotao1 luotao1 commented Jul 3, 2017

fix #1608.
finish feature of "Sequence Pooling with Stride".

@luotao1 luotao1 changed the title stride pooling for max layer stride pooling for max and average layer Jul 3, 2017
@luotao1 luotao1 requested a review from lcy-seso July 3, 2017 09:04
Copy link
Contributor

@lcy-seso lcy-seso left a 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.

@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

@luotao1 luotao1 left a 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.
Copy link
Contributor Author

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.
Copy link
Contributor Author

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.

@@ -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
Copy link
Contributor Author

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.

Copy link
Contributor

@lcy-seso lcy-seso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1 luotao1 merged commit 7f380c1 into PaddlePaddle:develop Jul 5, 2017
@luotao1 luotao1 deleted the stride branch July 5, 2017 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Sequence Pooling with Stride
2 participants