0
$\begingroup$

I do not understand this about GANs.

Apparently the Generator is supposed to receive a latent space vector as its input. Yet I couldn't find an example of how I can implement it in Pytorch. This is a problem for me, because different posts suggest different approaches.

Is it simply an image of Gaussian noise which is then served as an input to Generator's Convolutional Neural Network or is it a one-dimensional array passed through a Fully-Connected layer to the Generator?

$\endgroup$
1
$\begingroup$

The latent vector $z$ is just random noise.

The most frequent distributions for that noise are uniform: $z \sim U[-1,+1]$ or Gaussian: $z \sim \mathcal{N}(0, 1)$ . I am not aware of any theoretical study about the properties derived from different priors, so I think it's a practical choice: choose the one that works best in your case.

The dimensionality of the noise depends on the architecture of the generator, but most of the GANs I've seen use a unidimensional vector of length between 100 and 256.

In PyTorch, torch.Tensor.random_ and torch.randn can respectively be used to generate uniform and Gaussian noise.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.