(self)
Initialize the autoencoder network weights and biases.
Initialize the autoencoder network weights and biases.
Initialize the autoencoder network weights and biases .
def _create_network(self):
        """Initialize the autoencoder network weights and biases."""
        layer_dim = np.append(np.array(self.net_arch['n_input']),
                              self.net_arch['hidden_dim'])

        # Use recognition network to determine mean and (log) variance of
        # Gaussian distribution in latent space.
        self.z_mean, self.z_log_sigma_sq = \
            self._recognition_network(self.x, layer_dim)

        # Use the reparameterization trick to draw a sample, z, from the
        # Gaussian distribution, with epsilon as an auxiliary noise variable.

        eps = tf.random_normal((self.batch_size, self.net_arch['n_z']), 0, 1,
                               dtype=tf.float32)
        # z = mu + sigma * epsilon
        self.z = tf.add(self.z_mean, tf.multiply(tf.sqrt(
            tf.exp(self.z_log_sigma_sq)), eps))

        # Use generator to determine mean of Bernoulli distribution of
        # reconstructed input.
        self.x_reconstr_mean = \
            self._generator_network(self.z, layer_dim)
def _create_network ( self ) : layer_dim = np . append ( np . array ( self . net_arch [ 'n_input' ] ) , self . net_arch [ 'hidden_dim' ] ) # Use recognition network to determine mean and (log) variance of # Gaussian distribution in latent space. self . z_mean , self . z_log_sigma_sq = self . _recognition_network ( self . x , layer_dim ) # Use the reparameterization trick to draw a sample, z, from the # Gaussian distribution, with epsilon as an auxiliary noise variable. eps = tf . random_normal ( ( self . batch_size , self . net_arch [ 'n_z' ] ) , 0 , 1 , dtype = tf . float32 ) # z = mu + sigma * epsilon self . z = tf . add ( self . z_mean , tf . multiply ( tf . sqrt ( tf . exp ( self . z_log_sigma_sq ) ) , eps ) ) # Use generator to determine mean of Bernoulli distribution of # reconstructed input. self . x_reconstr_mean = self . _generator_network ( self . z , layer_dim )