"add sequence conv layer"#5117
Merged
dzhwinter merged 10 commits intoPaddlePaddle:developfrom Oct 30, 2017
Merged
Conversation
reyoung
reviewed
Oct 26, 2017
python/paddle/v2/framework/layers.py
Outdated
| return pool_out | ||
|
|
||
|
|
||
| def sequence_conv_pool(input, |
Collaborator
There was a problem hiding this comment.
_create_op_func_('sequence_conv_pool')
Contributor
Author
There was a problem hiding this comment.
Here we need to check validation of input arguments and need to create filter parameter based on two arguments.
JiayiFeng
reviewed
Oct 30, 2017
python/paddle/v2/framework/layers.py
Outdated
| attr=helper.param_attr, shape=filter_shape, dtype=dtype) | ||
| pre_bias = helper.create_tmp_variable(dtype) | ||
|
|
||
| input.set_lod(lod) |
python/paddle/v2/framework/layers.py
Outdated
| helper.append_op( | ||
| type='sequence_conv', | ||
| inputs={ | ||
| 'X': input, |
python/paddle/v2/framework/layers.py
Outdated
| return square_out | ||
|
|
||
|
|
||
| def conv1d(input, |
Collaborator
There was a problem hiding this comment.
Maybe sequence_conv is a better name?
Contributor
Author
There was a problem hiding this comment.
Rename conv1d to sequence_conv after discuss with @Canpio offline, since this function's behavior is different with conv2d, conv3d, fixed.
python/paddle/v2/framework/layers.py
Outdated
| # FIXME(dzh) : want to unify the argument of python layer | ||
| # function. So we ignore some unecessary attributes | ||
|
|
||
| ENUM_POOL_TYPE = ["max", "avg", "sqrt", "last", "first"] |
Collaborator
There was a problem hiding this comment.
Initialize ENUM_POOL_TYPE as a set to make the following if pool_type not in ENUM_POOL_TYPE: faster.
python/paddle/v2/framework/layers.py
Outdated
|
|
||
| helper.append_op( | ||
| type="sequence_pool", | ||
| inputs={"X": input}, |
python/paddle/v2/framework/layers.py
Outdated
| type="sequence_pool", | ||
| inputs={"X": input}, | ||
| outputs={"Out": pool_out}, | ||
| attrs={"strategy": pool_type, }) |
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.
Add sequence conv layer. This PR depends on #4814.