Deep Learning Errror in Course 4 Week 4 Assignment 2- Exercise 6

# Course 4 Week 4 Assignment 2- Exercise 6

  • Here is the lines where I feel the error is am I retreiving the a_G as expected?

        a_G = vgg_model_outputs(generated_image
    
  • # Compute the style cost
        #(1 line)
        { mentor edit: code removed}
    
        #(2 lines)
        # Compute the content cost
    
  • I see the following error in Exercise 6 - train_step
    ValueError: in user code:

    File "<ipython-input-56-5e121f66128b>", line 25, in train_step  \*
        J_content = compute_content_cost(a_C, a_G)
    File "<ipython-input-5-7ec9083dcb50>", line 25, in compute_content_cost  \*
        a_C_unrolled = tf.reshape(content_output, shape = \[\_, -1, n_C\])
    
    ValueError: Tried to convert 'tensor' to a tensor and failed. Error: Dimension 1 in both shapes must be equal, but are 50 and 25. Shapes are \[1,50,50,512\] and \[1,25,25,512\].
    	From merging shape 3 with other shapes. for '{{node Reshape_10/packed}} = Pack\[N=6, T=DT_FLOAT, axis=0\](Reshape_10/tensor/values_0, Reshape_10/tensor/values_1, Reshape_10/tensor/values_2, Reshape_10/tensor/values_3, Reshape_10/tensor/values_4, Reshape_10/tensor/values_5)' with input shapes: \[1,400,400,64\], \[1,200,200,128\], \[1,100,100,256\], \[1,50,50,512\], \[1,25,25,512\], \[1,25,25,512\].
    

Maybe take a look here for a clue…

Looks I found the problem, the code here is fine. The issue was one of functions I was calling. ComputeContentCost, though it had passed the test it was slightly problematic

2 Likes