-
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 RowL2NormLayer #3083
add RowL2NormLayer #3083
Conversation
limitations under the License. */ | ||
|
||
#include "Layer.h" | ||
#include "paddle/math/Matrix.h" |
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.
this line can be removed.
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.
@@ -2725,6 +2725,16 @@ def __init__(self, name, inputs, device=None): | |||
self.set_layer_size(input_layer0.size) | |||
|
|||
|
|||
@config_layer('row_l2_norm') | |||
class RowL2NormLayer(LayerBase): | |||
def __init__(self, name, inputs, device=None): |
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.
def __init__(self, name, inputs, **xargs):
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.
super(RowL2NormLayer, self).__init__( | ||
name, 'row_l2_norm', 0, inputs=inputs, device=device) | ||
config_assert(len(self.inputs) == 1, 'RowL2NormLayer must have 1 input') | ||
input_layer0 = self.get_input_layer(0) |
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.
input_layer0 -> input_layer
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.
inputs=[input.name], | ||
**ExtraAttr.to_kwargs(layer_attr)) | ||
return LayerOutput( | ||
name, LayerType.ROW_L2_NORM_LAYER, parents=[input], size=input.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.
add an unit test for this interface in https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/trainer_config_helpers/tests/configs
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.
add this layer in the doc: https://github.com/PaddlePaddle/Paddle/blob/develop/doc/api/v2/config/layer.rst
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.
add RowL2NormLayer