C4 W4 A1:Help! I can't figure it out where is wrong on "def triplet_loss(y_true, y_pred, alpha = 0.2):"

Please help me figure it out where is wrong,please~
{mentor edit: code removed}

Please don’t post your code on the forum. That breaks the course Honor Code.

Your code in Step 1 and Step 2 is missing the tf.reduce_sum() function. Please review the instructions.

Sorry for it. I’ll delete it now.
Thanks for your time~ I’ve figured it out

By the way, how could I delete it? It says I don’t have the right to delete it.

Hi,I’ve tried some other ways to finish it. But it’s wrong, why?


Instead of “axis=-1”, I wrote it as “axis=1” then it’s wrong. But from the tf.math.reduce_sum  |  TensorFlow Core v2.6.0
i think it’s right. Please help me, thank you ~

“axis = -1” is correct. The grader tests your code using a different size of data set. Axis 1 is not always the correct choice.

I edited your message to remove the code.