diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index 7dd4e3d00c33810e1506ba5bbd8b83235aab7296..42aac59d221d95c8eb9275d8e6baf460e1f4e3ed 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -3338,7 +3338,7 @@ class CosSimLayer(LayerBase): config_assert(len(self.inputs) == 2, 'CosSimLayer must have 2 inputs') config_assert( self.get_input_layer(0).size == self.get_input_layer(1).size, - 'inputs of CosSimLayer must have same dim') + 'The two inputs of CosSimLayer must have the same dimensionality.') self.config.cos_scale = cos_scale diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index 5ed6fe384a3a496e6284f510f82cf022d09836dc..e8f4f0035d8322b1fc2477bfd1a86806ecd6ac7b 100644 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -2338,7 +2338,7 @@ def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None): @layer_support() def l2_distance_layer(x, y, name=None, layer_attr=None): """ - This layer calculate and return the Euclidean distance between two input + This layer calculates and returns the Euclidean distance between two input vectors a and b. The equation is as follows: .. math:: @@ -2374,7 +2374,7 @@ def l2_distance_layer(x, y, name=None, layer_attr=None): Layer( name=name, type=LayerType.L2_DISTANCE, - inputs=[x.name, x.name], + inputs=[x.name, y.name], **ExtraLayerAttribute.to_kwargs(layer_attr)) return LayerOutput(name, LayerType.L2_DISTANCE, parents=[x, y], size=1) diff --git a/python/paddle/trainer_config_helpers/tests/configs/protostr/test_l2_distance_layer.protostr b/python/paddle/trainer_config_helpers/tests/configs/protostr/test_l2_distance_layer.protostr index ad488bfa9fc1babf3023c8e63902c41626697489..9ba33689edc893c2169a73679a04a6f51cfc83a8 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/protostr/test_l2_distance_layer.protostr +++ b/python/paddle/trainer_config_helpers/tests/configs/protostr/test_l2_distance_layer.protostr @@ -20,7 +20,7 @@ layers { input_layer_name: "x" } inputs { - input_layer_name: "x" + input_layer_name: "y" } } input_layer_names: "x"