From 929efdc592aa3d99e821d07b34234c0e60d0f085 Mon Sep 17 00:00:00 2001 From: caoying03 Date: Fri, 17 Nov 2017 17:53:59 +0800 Subject: [PATCH] follow comments. --- python/paddle/trainer/config_parser.py | 2 +- python/paddle/trainer_config_helpers/layers.py | 4 ++-- .../tests/configs/protostr/test_l2_distance_layer.protostr | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index 7dd4e3d00c3..42aac59d221 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 5ed6fe384a3..e8f4f0035d8 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 ad488bfa9fc..9ba33689edc 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" -- GitLab