Hello,
Im currently on the 3rd exercise “compute layer style cost”. I’m getting a value that is a little more than double what is expected, i’ve looked over the math many times and can’t seem to see what im doing wrong…
# Retrieve dimensions from a_G (≈1 line)
m, n_H, n_W, n_C = a_G.get_shape().as_list()
# Reshape the images to have them of shape (n_C, n_H*n_W) (≈2 lines)
a_S = tf.transpose(tf.reshape(a_S, shape=[n_C, n_H*n_W]))
a_G = tf.transpose(tf.reshape(a_G, shape=[n_C, n_H*n_W]))
# Computing gram_matrices for both images S and G (≈2 lines)
GS = gram_matrix(a_S)
GG = gram_matrix(a_G)
# Computing the loss (≈1 line)
J_style_layer = tf.reduce_sum(tf.square(tf.subtract(GS,GG)))/(4*(n_C**2)*((n_H*n_W)**2))```
my error:
AssertionError Traceback (most recent call last)
<ipython-input-15-f19da0544d50> in <module>
9 assert np.isclose(J_style_layer_GG, 0.0), "Wrong value. compute_layer_style_cost(A, A) must be 0"
10 assert J_style_layer_SG > 0, "Wrong value. compute_layer_style_cost(A, B) must be greater than 0 if A != B"
---> 11 assert np.isclose(J_style_layer_SG, 14.017805), "Wrong value."
12
13 print("J_style_layer = " + str(J_style_layer_SG))
AssertionError: Wrong value.