Skip to content

Instantly share code, notes, and snippets.

@AFAgarap
Last active November 16, 2019 18:49
Show Gist options
  • Save AFAgarap/ea53d037ab0bd4451c0b3a802022c7f4 to your computer and use it in GitHub Desktop.
Save AFAgarap/ea53d037ab0bd4451c0b3a802022c7f4 to your computer and use it in GitHub Desktop.
TensorFlow 2.0 implementation of a decoder for a vanilla autoencoder.
class Decoder(tf.keras.layers.Layer):
def __init__(self, intermediate_dim, original_dim):
super(Decoder, self).__init__()
self.hidden_layer = tf.keras.layers.Dense(
units=intermediate_dim,
activation=tf.nn.relu,
kernel_initializer='he_uniform'
)
self.output_layer = tf.keras.layers.Dense(
units=original_dim,
activation=tf.nn.sigmoid
)
def call(self, code):
activation = self.hidden_layer(code)
return self.output_layer(activation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment