Course4, week4: Trouble with programming assignment 1

For Exercise 1, I keep on getting thrown back the error that I have not added alpha, however I have added alpha with tf.add() as suggested.
I’ve done some testing of the code, I can’t seem to work out where the error is coming from.
Would you be able to help me please?

Please show us the actual error output that you are getting. Copy the output from running the failing test and paste it in your reply using the “{}” formatting tool to make sure it doesn’t get intepreted as “markdown”. Or you can include it as a screenshot using the Up Arrow tool and the formatting will be taken care of.

The other point to consider is that this is the very first test in that test cell. Those suggestions for what might be wrong are just that: suggestions. There are quite a few other “moving parts” in the triplet loss calculation. So it could be some other error. Please start by carefully comparing your code to the math formulas. The most common mistake here is to take the maximum of the sum, but that’s not what it says, right? The sum of the maxima is not the same as the max of the sums.

1 Like


Thanks for replying so quickly. I’ve managed to find the problem I forgot to sum over the difference between the anchor and positive (same for anchor and negative). Thanks for the help!