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

"add sequence conv layer" #5117

Merged
merged 10 commits into from
Oct 30, 2017

Conversation

dzhwinter
Copy link
Contributor

Add sequence conv layer. This PR depends on #4814.

@@ -276,6 +276,30 @@ def pool2d(input,
return pool_out


def sequence_conv_pool(input,
Copy link
Collaborator

Choose a reason for hiding this comment

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

_create_op_func_('sequence_conv_pool')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we need to check validation of input arguments and need to create filter parameter based on two arguments.

attr=helper.param_attr, shape=filter_shape, dtype=dtype)
pre_bias = helper.create_tmp_variable(dtype)

input.set_lod(lod)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is the lod from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

helper.append_op(
type='sequence_conv',
inputs={
'X': input,
Copy link
Collaborator

Choose a reason for hiding this comment

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

"X": [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.

@@ -204,6 +218,47 @@ def square_error_cost(input, label, **kwargs):
return square_out


def conv1d(input,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe sequence_conv is a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rename conv1d to sequence_conv after discuss with @Canpio offline, since this function's behavior is different with conv2d, conv3d, fixed.

# 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"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Initialize ENUM_POOL_TYPE as a set to make the following if pool_type not in ENUM_POOL_TYPE: faster.

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.


helper.append_op(
type="sequence_pool",
inputs={"X": input},
Copy link
Collaborator

Choose a reason for hiding this comment

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

'X': [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.

type="sequence_pool",
inputs={"X": input},
outputs={"Out": pool_out},
attrs={"strategy": pool_type, })
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove ,

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
Collaborator

@JiayiFeng JiayiFeng left a comment

Choose a reason for hiding this comment

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

LGTM.

@dzhwinter dzhwinter merged commit f4710cf into PaddlePaddle:develop Oct 30, 2017
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.

3 participants