rosinality / vq-vae-2-pytorch

Implementation of Generating Diverse High-Fidelity Images with VQ-VAE-2 in PyTorch
Other
1.6k stars 270 forks source link

about one_hot #40

Open Sky-zhan opened 4 years ago

Sky-zhan commented 4 years ago

Thanks for sharing your helpful work. There is a question I am wondering, that is the code ‘dist = (...)’ and ‘embed_onehot = F.one_hot(...)’, existing in class Quantize. I didn't find the corresponding content in the original paper,i.e., ‘Generating Diverse High-Fidelity Images with VQ-VAE-2’. Could you tell me where it comes from? Thanks a lot.

rosinality commented 4 years ago

You can refer to VQ-VAE implementation of Sonnet. (https://github.com/deepmind/sonnet/blob/master/sonnet/python/modules/nets/vqvae.py) It is for efficiently implement quantization.

Sky-zhan commented 4 years ago

thanks