Week 4 Art Generation exercise bug

Exercise 4 - compute_style_cost part has bug with weighted style cost.
Inside for loop there is
J_style += weight[1] * J_style_layer

but it should be
J_style += weight[i] * J_style_layer

No, I don’t think that is an error.

In the for-loop, ‘i’ and ‘weight’ will be assigned as pairs via the zip() function. The ‘weight’ values come from the “STYLE_LAYERS” dictionary. weight[0] is a layer name, and weight[1] is the style’s cost factor.

2 Likes