def encode_z(self, x, weights, biases):
c1 = tf.nn.relu(batch_normal(conv2d(x, weights['e1'], biases['eb1']), scope='enz_bn1'))
c2 = tf.nn.relu(batch_normal(conv2d(c1, weights['e2'], biases['eb2']), scope='enz_bn2'))
c2 = tf.reshape(c2, [self.batch_size, 128*7*7])
#using tanh instead of tf.nn.relu.
result_z = batch_normal(fully_connect(c2, weights['e3'], biases['eb3']), scope='enz_bn3')
#result_c = tf.nn.sigmoid(fully_connect(c2, weights['e4'], biases['eb4']))
#Transforming one-hot form
#sparse_label = tf.arg_max(result_c, 1)
#y_vec = tf.one_hot(sparse_label, 10)
return result_z
评论列表
文章目录