C3W3_Assignment - Exercise 02

Hi @RyeToast

It’s against the rules to post your solution code, so please remove it (including your previous post).

I found my old excel file and updated the calculations (which you can check against yourself by printing them):

So first hint, in this Assignment we dot multiply v2 with v1 (not other way around). This is the choice of course creators - we compare the right hand side questions with left hand side questions (not the other way around; it makes a difference when questions are not duplicates).

Second hint - you deleted some code comments/hints. In particular, for mask_exclude_positives you need:

    # create a composition of two masks: 
    # the first mask to extract the diagonal elements, 
    # the second mask to extract elements in the negative_zero_on_duplicate matrix that are larger than the elements in the diagonal 

you just have one part of it (the first is easier, you can see it in the picture).

Third hint, again, I see you have different code comment, which should have been:

    # add the two losses together and take the `tf.math.reduce_sum` of it

Cheers

2 Likes