I’m getting error in compute_layer_style_cost
when I’m using tf.suare sand tf.multiply its giving tf.float32!=tf.int32:
AssertionError Traceback (most recent call last)
in
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.
my code is:
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_H*n_W)**2)*((n_C)**2))
Any suggestion will be helpful