-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 pyton wrapper for row conv operator. #7575
Conversation
… fix-7555 Conflicts: doc/api/v2/fluid/layers.rst python/paddle/v2/fluid/layers/nn.py
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.
Please to add unit test.
python/paddle/v2/fluid/layers/nn.py
Outdated
|
||
Args: | ||
input (Variable): Input variable, a 2D LoDTensor with shape [T, D]. | ||
future_context_size (int): Future context 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.
Better to give example, assumed future_context_size = 2, the context size of convolution is 3 ....
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.
Thanks, done.
""" | ||
helper = LayerHelper('row_conv', **locals()) | ||
dtype = helper.input_dtype() | ||
filter_shape = [future_context_size + 1, input.shape[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.
Better to check the input.shape.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.
It seems the exception information is informational enough.
python/paddle/v2/fluid/layers/nn.py
Outdated
In the above equation: | ||
|
||
* :math:`Out_{i}`: The i-th row of output variable with shape [1, D]. | ||
* :math:`\\tau`: Future context size. Please note, the shape of |
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.
Quick clarification: The value of
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.
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.
Yeah, actually i was concerned about the wording in your doc: ":math:\\tau
: Future context 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.
Sorry for this minor and maybe frustrating comment, but I think if
Maybe I misunderstood something?
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.
I think it is correct, we execute future context size + 1
times of sum operations.
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 range of j
is [i, \tau + i]
. Should be executed
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.
Thanks.. I missed that
python/paddle/v2/fluid/layers/nn.py
Outdated
"""Row Conv Operator. This layer will apply lookahead convolution to | ||
**input**. The input variable should be a 2D LoDTensor with shape [T, D]. | ||
Parameters with shape [future_context_size + 1, D] will be created. The math | ||
equation of row convolution is as following: |
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.
Minor typo: following -> follows
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.
LGTM.
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-7555 Conflicts: python/paddle/v2/fluid/layers/nn.py
… fix-7555 Conflicts: python/paddle/v2/fluid/layers/nn.py python/paddle/v2/fluid/tests/test_layers.py
Resolves #7555