|
|
|
@ -2341,7 +2341,7 @@ def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None):
|
|
|
|
|
def l2_distance_layer(x, y, name=None, layer_attr=None):
|
|
|
|
|
"""
|
|
|
|
|
This layer calculates and returns the Euclidean distance between two input
|
|
|
|
|
vectors a and b. The equation is as follows:
|
|
|
|
|
vectors x and y. The equation is as follows:
|
|
|
|
|
|
|
|
|
|
.. math::
|
|
|
|
|
l2_distance(\\mathbf{x}, \\mathbf{y}) = \\sqrt{\\sum_{i=1}^D(x_i - y_i)}
|
|
|
|
@ -2372,7 +2372,7 @@ def l2_distance_layer(x, y, name=None, layer_attr=None):
|
|
|
|
|
:rtype: LayerOutput
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
assert isinstance(x, LayerOutput) and isinstance(x, LayerOutput)
|
|
|
|
|
assert isinstance(x, LayerOutput) and isinstance(y, LayerOutput)
|
|
|
|
|
Layer(
|
|
|
|
|
name=name,
|
|
|
|
|
type=LayerType.L2_DISTANCE,
|
|
|
|
|