C3W3 Triplet Loss value is wrong

Hello @skinx.learning

you have incorrect codes for

  1. use tf.linalg.matmul to take the dot product of the two batches.
    Don’t forget to transpose the second argument using transpose_b=True
    YOU HAVE USED MARGIN, NOT REQUIRED. ALSO THE TWO BATCHES, need to be mentioned as v2, v1 and not v1, v2

2.subtract the diagonal from scores. You can do this by creating a diagonal matrix with the values of all positive examples using tf.linalg.diag
FOR THIS CODE LINE YOU ARE SUPPOSE TO SUBSTRACT tf.linglg.diag of positive examples(recalled before use tf.linalg.diag_part to grab the cosine similarity of all positive examples) from scores.

Kindly use the search engine, there are many threads related to triplet loss where you will find solution to your problem.

Regards
DP