stochastic_layer.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:vae_renyi_divergence 作者: YingzhenLi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号