def encode(self, input, sampling):
output = input
for layer in self.D_layers:
output = layer.encode(output)
# now compute mu
Mu = self.Mu_layer.encode(output)
if sampling:
shape = Mu.get_shape()
eps = tf.random_uniform(shape)
output = tf.select(eps - Mu <= 0, tf.ones(shape), tf.zeros(shape))
else:
output = Mu
output = output * 2.0 - 1.0
return output, Mu
stochastic_layer.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录