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
- 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.
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?
Please be aware that the mentors are just fellow student volunteers. We do not have any magic powers to look at anyone else’s notebooks.
Understood. I was just trying to find a way out, didn’t actually thought you can access my file.
I can’t believe my mistake! I forgot that “^” this is NOT power in python. It’s double asterisk **
I spent +12 hrs on this
Glad to hear you found the answer! If it’s any comfort, there was another thread by someone making that same mistake recently on this very exercise.
Absolutely unbelievable. Thank you so much, anyways.
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.
thank you. its help me a lot!
I did exactly the same mistake and also had spent a lot of time to find what is the problem.