Skip to content

Instantly share code, notes, and snippets.

@a-agmon
Created July 28, 2021 19:53
Show Gist options
  • Save a-agmon/7417d1e1c5cc70a5d15b5204aef05882 to your computer and use it in GitHub Desktop.
Save a-agmon/7417d1e1c5cc70a5d15b5204aef05882 to your computer and use it in GitHub Desktop.
# encoder model
inputs = Input(shape=input_shape, name='encoder_input')
x = Dense(intermediate_dim, activation='relu')(inputs)
z_mean = Dense(latent_dim, name='z_mean')(x)
z_log_var = Dense(latent_dim, name='z_log_var')(x)
# use the reparameterization trick and get the output from the sample() function
z = Lambda(sample, output_shape=(latent_dim,), name='z')([z_mean, z_log_var])
encoder = Model(inputs, z, name='encoder')
encoder.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment