Sampling from a sphere instead of a cube
Especially the trick number 3 (sampling z from a sphere) sounds interesting to me, but I'm unsure how it should be implemented.
Is it just that I need to normalize my z vector to have unit length such that it lies on the surface of a hyper sphere?
If not is there some special function to sample points from inside a hypersphere in python?
Is there a repository where these ganhacks are already implemented (for dcgan)?
you can find slerp code in this comment https://github.com/soumith/dcgan.torch/issues/14#issuecomment-199171316
As far as I understand this the slerp code is only for interpolating between two points on a hypersphere. Isn't it also necessary to replace the z vector that is used as input to the generator during dcgan training?
Right now I generate z like this:
batch_z = np.random.uniform(-1, 1, [batch_size, z_dim]).astype(np.float32)
You should also sample from a normal distribution.
Just use np.random.normal