ArminJ
February 14, 2025, 5:48pm
1
The Programming assignment is wrong in expecting the value 0.7. I have double checked and tripled checked the results by hand, it should be 2.4
hi @ArminJ
check if these post help you debug
Hello @skinx.learning
you have incorrect codes for
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.…
Hi @roses_r_red
Your code requires correction for triplet_loss1 and triplet_loss2
While calculating the A and B
A = subtract positive from margin and add closest_negative
B = subtract positive from margin and add mean_negative
You have used correctly the codes but because you have missed tuppling in these codes caused these error.
Remember the instructions mentions first to subtract (margin-positive) and then add closest negative for A and mean_negative for B
Also while recalling triplet …
Regards
DP
this is another thread comment which mentions each step value which you can check using print and match with your value and know where you are going wrong
Hi @Jawad
You can heck your calculations (by printing intermediate values) against these and see where they start to differ:
[image]
Cheers