auto encoding in python

Solutions on MaxInterview for auto encoding in python by the best coders in the world

showing results for - "auto encoding in python"
Nicola
13 Mar 2018
1import keras
2from keras import layers
3
4# This is the size of our encoded representations
5encoding_dim = 32  # 32 floats -> compression of factor 24.5, assuming the input is 784 floats
6
7# This is our input image
8input_img = keras.Input(shape=(784,))
9# "encoded" is the encoded representation of the input
10encoded = layers.Dense(encoding_dim, activation='relu')(input_img)
11# "decoded" is the lossy reconstruction of the input
12decoded = layers.Dense(784, activation='sigmoid')(encoded)
13
14# This model maps an input to its reconstruction
15autoencoder = keras.Model(input_img, decoded)
16