NLP C3 W3 Assignment

In the exercise 2nd of the assignment I implemented the custom Triplet Loss function in TensorFlow for a similarity learning task. The function is designed to compute the loss between two vectors v1 and v2 based on the cosine similarity and a margin parameter. However, the output of the function does not match the expected output.

The Triplet Loss function is expected to return a loss value of approximately 0.70 for the given input vectors v1 and v2. However, the actual output differs from this expectation. It’s 4.453507693899828 in my case.

I have verified the implementation and made sure that there’s no syntax error or typing mistake.

I would appreciate any insights or suggestions on how to troubleshoot and resolve this issue effectively. Thank you for your assistance!

Hi @Abhay_Pancholi

Here are the calculations that you could check where your implementation went wrong.

Cheers

Thank you @arvyzukai for your help!
I resolved that issue but got another error for the ‘test your function’ block.
The error message is as follows:
[test_case(msg=‘There was an error evaluating the TripletLoss function.’, want=None, got='{{function_node _wrapped__LogicalOr_device/job:localhost/replica:0/task:0/device:GPU:0}} required broadcastable shapes [Op:LogicalOr] name: ', failed=True)]