get this error while running the train_step(generated_image) function… pls help

Two questions:

-Does your compute_layer_style_cost() function work correctly?

-In your compute_style_cost() function, are you calling compute_layer_style_cost()?

Yes, compute_layer_style_cost() function does works correclty and yeah the compute_layer_style_cost() function is called in the compute_style_cost() function(it was already there).

Hello @CSB_38_Waseem,

Let’s analyze the Traceback:

From it, we realize that the problem happens in `tf.subtract`

, and that should bring our focus onto `a_S`

and `a_G`

. Remember `a_S`

is returned from `vgg_model_outputs(...)`

which was defined in Section 5.4. If you read that section, it said `vgg_model_outputs`

returns a list of the outputs for the middle layers.

Therefore, you are letting `tf.subtract`

to work on a list of tensors of different shapes (since the middle layers have different shapes), and it is also why you see those shapes that I have underlined.

Now, your objective is to calculate the style cost, and you will further need to calculate the content cost and the total cost. However, remember we have defined some functions in previous exercises to handle them? I suggest you to revisit them and try to figure out how *they* handle `a_S`

, `a_G`

, and `a_C`

which are lists, and then see if you can understand the problem behind this error. Then, use those defined functions to do the job.

Cheers,

Raymond

TYSM, helped me to solve the issue