Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling from a sphere instead of a cube #28

Open
mgarbade opened this issue Nov 29, 2017 · 3 comments
Open

Sampling from a sphere instead of a cube #28

mgarbade opened this issue Nov 29, 2017 · 3 comments

Comments

@mgarbade
Copy link

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)?

@soumith
Copy link
Owner

soumith commented Nov 29, 2017

you can find slerp code in this comment soumith/dcgan.torch#14 (comment)

@mgarbade
Copy link
Author

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)

@alexrakowski
Copy link

You should also sample from a normal distribution.
Just use np.random.normal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants