Week-4 Assignment -2 train_step() error

Hey everyone,
I’ve been trying to run the train_step function and it is giving me this error name J_style_layer is not defined. compute_style_cost is working perfectly.

Can anyone help?

NameError: in user code:

<ipython-input-28-e6075e5f7bb1>:19 train_step  *
    J_style = compute_style_cost(a_S, a_G)
<ipython-input-31-1355fdd29629>:28 compute_style_cost  *
    J_style_lay = compute_layer_style_cost(a_S[i], a_G[i])
<ipython-input-9-067d39b3057d>:30 compute_layer_style_cost  *
    return J_style_layer

NameError: name 'J_style_layer' is not defined

Thank you

Your “a_G = …” line is using the wrong function argument. “preprocessed_content” is not correct.

Thank you for replying. I corrected that to a_G = vgg_model_outputs(generated_image). It still shows the same error.

Your code after correctly modifying a_G seems clear.

Can you check if you accidentally missed to execute the compute_style_cost function (exercise 4) or in generally any of the previous cells of code ?

your compute_style_cost requires one more argument