2021SC@SDUSC
代码位置:similarity/distances.py at master · tensorflow/similarity · GitHub
@tf.keras.utils.register_keras_serializable(package="Similarity")
class EuclideanDistance(Distance):
"""Compute pairwise euclidean distances between embeddings.
The [Euclidean Distance](https://en.wikipedia.org/wiki/Euclidean_distance)
is the standard distance to measure the line segment between two embeddings
in the Cartesian point. The larger the distance the more dissimilar
the embeddings are.
**Alias**: L2 Norm, Pythagorean
"""
def __init__(self):
"Init Euclidean distance"
super().__init__('euclidean', ['l2', 'pythagorean'])
@tf.function