Art Style Transfer Assignment Problem with training function

Hi I am working on the final question for assignment 2 week 4 and I am getting the following error. AttributeError: in user code:

<ipython-input-111-402674422ff3>:19 train_step  *
    J_style = compute_layer_style_cost(a_S, a_G)
<ipython-input-44-8099f13b9e98>:16 compute_layer_style_cost  *
    m, n_H, n_W, n_C = a_G.get_shape().as_list()

AttributeError: 'list' object has no attribute 'get_shape'

But I am using the code suggested in the notebook to calculate a_G so I am not sure what I should modify to rectify this issue. The rest of my code looks like this. Any help would be greatly appreciated.

RESOLUTION + NEW PROBLEM: I was using compute_layer_style_cost instead of compute_style_cost which allowed me to pass the tests but after submitting it marked that function incorrect. How is this possible? How do I know what I did wrong?

{moderator edit - solution code removed}

Maybe there is a problem in one of the functions you’re calling from train_step().

Passing the unit tests does not prove your code is perfect.

2 Likes

I agree with @TMosh. In addition, It is always a good practice to check whether you are giving the required arguments when calling a function. I hope this will eventually lead you to the solution.

Regards.

2 Likes

ok, I’ll investigate that. Thanks!

I am also having same problem. how to do you solve it?

@dev24: Please be a little more specific about what you mean by the “same problem”.

I have solved my problem thanks for replying

Congrats on solving the problem under your own power! Thanks for confirming.