Skip to content
Snippets Groups Projects
Commit 8ecba2f8 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

L2 normalize the embeddings

parent 1952c2f5
Branches
Tags v1.7.14
1 merge request!13Updates
Pipeline #
......@@ -41,6 +41,10 @@ class ContrastiveLoss(BaseLoss):
def __call__(self, label, left_feature, right_feature):
with tf.name_scope("contrastive_loss"):
label = tf.to_float(label)
left_feature = tf.nn.l2_normalize(left_feature, 1)
right_feature = tf.nn.l2_normalize(right_feature, 1)
one = tf.constant(1.0)
d = compute_euclidean_distance(left_feature, right_feature)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment