Commit 8ecba2f8 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

L2 normalize the embeddings

parent 1952c2f5
Pipeline #12296 failed with stages
in 4 minutes and 31 seconds
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment