Art Generation: Exercise 4 - compute_style_cost

{moderator edit - solution code removed}

Dear all,

I am having trouble understanding the above code, more specifically the for loop. This is because, as far as I understand, the ZIP is “zipping” two objects with different dimensions (a_S and STYLE_LAYERS).

Can someone clarify?

Much appreciated.

But those two inputs being “zipped” together there do have the same number of elements, right? This was described in the instructions over the previous several sections. You select the particular layers you’re going to use for the “style” and then STYLE_LAYERS gives the names and weights associated with each selected style layer.

Thanks Paul for the feedback.

From your words then, even though style_image_output has more entries than STYLE_LAYERS, the ZIP function so call selects the common denominator of these 2 objects, i.e., only the entries in STYLE_LAYERS (which are less).

If that is the case, STYLE_LAYERS does not include the content layer image which is block5_conv4. So why do we need to exclude it in the previous statements if we already planned on not using it anyways?

Thank you for your patience.