TripletLossFn C3_W4

mask_exclude_positives = np.identity(batch_size) == 1 |(scores - fastnp.diagonal(positive))> positive.reshape(batch_size, 1)

what is wrong in the above formula for week 4 assignment grade 3 ?

getting this error:ValueError: axis 1 is out of bounds for array of dimension 1

1 Like

Hi @Ena_Chandak,

Firstly, you are using the np function, but I believe you won’t get graded properly if you don’t use the trax.fastmath’s numpy, which is fastnp.

Secondly, you are ignoring the code comment which is telling you the variable to use:
# the second mask to extract elements in the negative_zero_on_duplicate matrix that are larger than the elements in the diagonal.

Hope this helps,
Mubsi