catgan_train.py 文件源码

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

项目:catgan 作者: smayru 项目源码 文件源码
def __call__(self, x, test=False):

        mu_array1=chainer.Variable(xp.array(xp.zeros([batchsize,784]),dtype=np.float32))
        log_std_array1=chainer.Variable(xp.log(0.09)*xp.array(xp.ones([batchsize,784]),dtype=np.float32))

        mu_array2=chainer.Variable(xp.array(xp.zeros([batchsize,1000]),dtype=np.float32))
        log_std_array2=chainer.Variable(xp.log(0.09)*xp.array(xp.ones([batchsize,1000]),dtype=np.float32))

        mu_array3=chainer.Variable(xp.array(xp.zeros([batchsize,500]),dtype=np.float32))
        log_std_array3=chainer.Variable(xp.log(0.09)*xp.array(xp.ones([batchsize,500]),dtype=np.float32))

        mu_array4=chainer.Variable(xp.array(xp.zeros([batchsize,250]),dtype=np.float32))
        log_std_array4=chainer.Variable(xp.log(0.09)*xp.array(xp.ones([batchsize,250]),dtype=np.float32))

        mu_array5=chainer.Variable(xp.array(xp.zeros([batchsize,250]),dtype=np.float32))
        log_std_array5=chainer.Variable(xp.log(0.09)*xp.array(xp.ones([batchsize,250]),dtype=np.float32))

        mu_array6=chainer.Variable(xp.array(xp.zeros([batchsize,250]),dtype=np.float32))
        log_std_array6=chainer.Variable(xp.log(0.09)*xp.array(xp.ones([batchsize,250]),dtype=np.float32))

        x=x+F.gaussian(mu_array1,log_std_array1)
        h1=F.leaky_relu(self.bn0(self.l0(x)+F.gaussian(mu_array2,log_std_array2),test),slope=0.1)
        h2=F.leaky_relu(self.bn1(self.l1(h1)+F.gaussian(mu_array3,log_std_array3),test),slope=0.1)
        h3=F.leaky_relu(self.bn2(self.l2(h2)+F.gaussian(mu_array4,log_std_array4),test),slope=0.1)
        h4=F.leaky_relu(self.bn3(self.l3(h3)+F.gaussian(mu_array5,log_std_array5),test),slope=0.1)
        h5=F.leaky_relu(self.bn4(self.l4(h4)+F.gaussian(mu_array6,log_std_array6),test),slope=0.1)
        h6=F.softmax(self.l5(h5))


        return h6
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号