keras-io
keras-io copied to clipboard
VQ-VAE inference on trained prior
trafficstars
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?
@fchollet, can you please explain. Thankyou.