Week : 3, Course 3 from the NLP specialization

Link_to_item:

Description: Hi, Have an issue with the triplet loss where my answer is wrong,

so the logic goes that we are implementing one shot learning similar to the facial recognition assignment in a different specialization, except we dont need to extract the loss 1 and loss 2 from different calculations and instead we use multiply all the Pairs together and then pick how much was it correct in picking its duplicate and then we look for the worse performing false positive from the same calculation aka matrix multiplication, at least this is what I am understanding.

my code logic is as follows:

scores= matmul(v1,v2,transpose_b=True)

positive = diag_part(scores)

then we subtract scored with the diagonal positive matrix to create negative zero duplicate

then using that calculate the mean_negative by producing the reduce of negative_zero_on_duplicate,axis=1)/(batch_size - 1)

up until here I am not sure if my word is correct or not and I do feel like my math logic is wrong here simply because I don’t fully comprehend the usage of matrix operations in one shot learning and hardness, I can see how efficient it is but simply can’t wrap my head around it, if someone can correct my logic for coding and/or explain the math operations it would be much appreciated.