You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made an issue in the original implementation repository.
For this PyTorch implementation, It can be easily fixed by applying sqrt on random radius samples from a uniform distribution in rand_cirlce2d.
defrand_cirlce2d(batch_size):
""" This function generates 2D samples from a filled-circle distribution in a 2-dimensional space. Args: batch_size (int): number of batch samples Return: torch.Tensor: tensor of size (batch_size, 2) """# r = np.random.uniform(size=(batch_size)) # beforer=np.sqrt(np.random.uniform(size=(batch_size))) # aftertheta=2*np.pi*np.random.uniform(size=(batch_size))
x=r*np.cos(theta)
y=r*np.sin(theta)
z=np.array([x, y]).Treturntorch.from_numpy(z).type(torch.FloatTensor)
Hi,
Thank you for sharing the code.
In the original implementation, I found that the function
generateZ
inMNIST_SlicedWassersteinAutoEncoder_Circle.ipynb
does not generate sample points in a circle uniformly.The generated sample points are more dense at the center of a circle. This can affect the resulting latent space.
I made an issue in the original implementation repository.
For this PyTorch implementation, It can be easily fixed by applying
sqrt
on random radius samples from a uniform distribution inrand_cirlce2d
.Here is an related article: Generate a random point within a circle (uniformly)
Best,
Oh-Hyun
The text was updated successfully, but these errors were encountered: