Last active
November 16, 2019 18:49
-
-
Save AFAgarap/ea53d037ab0bd4451c0b3a802022c7f4 to your computer and use it in GitHub Desktop.
TensorFlow 2.0 implementation of a decoder for a vanilla autoencoder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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