Hello
W4 Assignment 2, exercise 3 has an additional hints that talks about the shape of unrolled matrix before itβs inputed into the Gram function
Additional Hints
Since the activation dimensions are (π,ππ»,ππ,ππΆ) whereas the desired unrolled matrix shape is (ππΆ,ππ»βππ), the order of the filter dimension ππΆ is changed. So tf.transpose can be used to change the order of the filter dimension.
What happens to the samples after unrolling? shouldnβt it be (nC, nHβnWβm)? (nC, nHβnW) is missing a fourth dimension.
Actually the way the instructions are written is a little misleading. If you actually check how they use compute_layer_style_cost, youβll find that they only call it for one sample at a time. You can actually add an assertion that m is either 1 or None.
@paulinpaloalto
Thanks for the answer. I am somehow very stuck. I understand that I need to transpose and then reshape. The dimensions work as intended:
The [m, n_H, n_W, n_C] becomes [n_C, n_Hβn_Wβm] βm is 1β. I used -1 in reshape so it doesnβt matter if m is provided or not. But my final number is very large (2808.4368). I have spent an exorbitant amount of time on this issue to no avail. Could you please take a look at my solution?
Damnβ¦ I was stuck in exactly the same spot. In fact, I searched the threads for 2808 because thatβs exactly the answer I got as well. Thank you so much.