Week 4, Assignment 2, Exercise 1

The output for this exercise should be tf.reduce_sum(tf.square(a_C_unrolled-a_G_unrolled))/2 but this computes a value too high according to the assert statements in the grader. Instead

tf.reduce_sum(tf.square(a_C_unrolled-a_G_unrolled))/n_H/ n_W/ n_C/4

gives us the correct value.

What is happening here !? In the course videos the content loss was defined just with a denominator of 2 ie.

{\cal J}_{content}(a_C, a_G) = \frac12||a_C - a_G||_F^2

The content cost is clearly shown in the instructions for that section and it does not agree with the formula you show:

1 Like

It is a good point that this is different than what is shown in the lectures. I’ll file a git issue about that. Thanks for pointing out the inconsistency between the lecture and the assignment, but I claim the assignment is self-consistent.

1 Like