NLP C3_W4 Triplet Loss

Hi I don’t see anyone with my problem there’s another similar one but his wrong result is 1.0, but mine is 0.796. I’ve finished the rest of the notebook and passed the assignment. I am just curious what went wrong cause I’ve tried many things myelf. Thanks.

Hi @Qingyang_Li

You can check this post and compare where your values start to differ (for example, by adding print(..) statements of your variables). This way you can quickly find where you went wrong.


I have a bug with my TripletLossFn function, I checked solutions on the internet, and they differ only in the part of the masks, but I add it correctly according to the request, I have done step by step tests on another notebook in colab, and I get what I expect according to what I understand in each step, but the result definitely does not match what is expected in the course notebook. Finally the solution was that by copying from the internet at the end I was doing an average and not a sum.

1 Like

Hi I found my mistake it was a small mismatch of the dimensions, the smaller dimension got broadcasted wrong to the bigger dimension. So I am not banging my head over it anymore XD