November 2017
Intermediate to advanced
274 pages
6h 16m
English
Th following code shows AutoEncoder class. This class with be instantiated for samples in next few sections to create autoencoders:
import tensorflow as tfclass AutoEncoder: def __init__(self, num_input, num_hidden, transfer_function=tf.nn.softplus, optimizer = tf.train.AdamOptimizer()): self.num_input = num_input self.num_hidden = num_hidden self.transfer = transfer_function network_weights = self._initialize_weights() self.weights = network_weights # model for reconstruction of the image self.x_var = tf.placeholder(tf.float32, [None, self.num_input]) self.hidden_layer = self.transfer(tf.add(tf.matmul(self.x_var, self.weights['w1']), self.weights['b1'])) self.reconstruction = tf.add(tf.matmul(self.hidden_layer, self.weights[ ...
Read now
Unlock full access