# Variational autoencoder with probabilistic layers

**URL:** <https://discuss.ai.google.dev/t/variational-autoencoder-with-probabilistic-layers/30836>\
**Category:** General Discussion\
**Tags:** help\_request\
**Created:** [July 19, 2022, 3:43am UTC](https://discuss.ai.google.dev/t/variational-autoencoder-with-probabilistic-layers/30836 "2022-07-19T03:43:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![G\_P](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/g_p/32/12034_2.png) [@G\_P](https://discuss.ai.google.dev/u/G_P)\
**Post date:** [July 19, 2022, 3:43am UTC](https://discuss.ai.google.dev/t/variational-autoencoder-with-probabilistic-layers/30836/1 "2022-07-19T03:43:43Z")

</div>

Hi!  
I’m trying to build a variational autoencoder adjusting the tutorial [example](https://www.tensorflow.org/probability/examples/Probabilistic_Layers_VAE) with probabilistic layers.

My data are grayscale images with pixel values 0 to 255. So I’m confused on how to adjust the decoder code from the example. Particularly Im confused what distribution layer to add to the output of the decoder. I think an probabilistic layer would make for an easy loss function (log\_prob).

Also my pixels in most of the pictures follow a similar distribution.

 ![Figure_1](https://d3qe71uytubmmx.cloudfront.net/original/2X/0/051c8c5a75bbf7f07b787b4da9ccc363596975fb.png)

I’m new here and new with deep learning so sorry if I’m asking something trivial.

Thanks in advance.
