keras-team / keras-io

Keras documentation, hosted live at keras.io
Apache License 2.0
2.73k stars 2.03k forks source link

VQ-VAE inference on trained prior #1393

Open lb-97 opened 1 year ago

lb-97 commented 1 year ago

After training prior with PixelCNN, during inference probabilities of codebook indices are calculated. There's a distribution sampler used to pick/sample a index instead of choosing the highest probability index-

outputs = pixel_cnn(inputs, training=False)
categorical_layer = tfp.layers.DistributionLambda(tfp.distributions.Categorical)
outputs = categorical_layer(outputs)

Why is that so? Why use this sampler? Is this distribution what makes the PixelCNN model generative? On removing this distribution sampler, the model is deterministic as it's just a bunch of convolutional layers. Can someone kindly explain the necessity of these lines of code?

lb-97 commented 1 year ago

@fchollet, can you please explain. Thankyou.