After trying many, many variations, I finally got past this using some very ugly code with a naive for loop. Can someone message me a sophisticated solution that uses PyTorch functions?
There have been some earlier threads about this implementation. E.g. did you read this one?
I already got the code to work, but despite reading several threads and browsing the PyTorch documentation, stack exchange, etc, I could not get a sophisticated version working and I’m burnt out on tinkering with it. I just want to see the best practice for this type of situation.
The information is towards the end of that thread. E.g. this post and the one after that give the idea.
Finally got something reasonable, thank you.
What a pain… I think more details on PyTorch manipulations should be added to this course. I find that I’m spending almost no time on GAN concepts or architecture, while I often spend several hours per assignment trying to learn the details of PyTorch tensor manipulations that I need but were not taught in the course. A PyTorch specialty would be nice to complement all the Tensorflow specific courses.
P.S. Why is one the the test cases a tensor of size (n_samples, 1) when this assignment is explicitly about generating 2D images? It feels almost like it was thrown in just to make the exercise more annoying, because we can’t assume the dimension of the input. Would we ever encounter anything other than size (n_samples, height, width) when we go to actually use this…?