C4W4 Exercise 1. axis=1 gives the result but doesnt pass the grader

Finally found the answer to week 4 exercise 1 in the first programming exercise, but there is a doubt still rounding my head.

My mistake was applying the reduce_sum method, I coded axis=1 and the grader threw an error message. however, I found that the number was the one that was supposed to appear. Finally, I fixed it by setting axis=-1, but is it not the same setting axis=1 than axis=-1 in a 2D array? shapes and the final result were supposedly the same but I don’t know if there is something that I am missing.

Thanks in advance!

Thanks for bringing this up.

Your understanding of using axis=1 is correct since the documentation for the method says that anchor, positive and negative have a batch dimension. The staff have been informed about this issue. Please use -1 till this gets resolved since it’ll get things to work even if the test input is 1D (which should be fixed with a batch dimension of 1 to make it [BATCH SIZE, EMBEDDING]).

1 Like