Skip to content

Instantly share code, notes, and snippets.

@AFAgarap
Created March 16, 2019 07:09
Show Gist options
  • Save AFAgarap/1456f9984131d2cf0fe9eb34adf788fe to your computer and use it in GitHub Desktop.
Save AFAgarap/1456f9984131d2cf0fe9eb34adf788fe to your computer and use it in GitHub Desktop.
TensorFlow 2.0 implementation of a vanilla autoencoder model.
class Autoencoder(tf.keras.Model):
def __init__(self, intermediate_dim, original_dim):
super(Autoencoder, self).__init__()
self.encoder = Encoder(intermediate_dim=intermediate_dim)
self.decoder = Decoder(intermediate_dim=intermediate_dim, original_dim=original_dim)
def call(self, input_features):
code = self.encoder(input_features)
reconstructed = self.decoder(code)
return reconstructed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment