train_gan.py 文件源码

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

项目:chainer_img2img_example 作者: taizan 项目源码 文件源码
def loss_dis(self, dis, dis_real, dis_fake):
        batchsize,_,w,h = dis_real.data.shape

        L1 = (2+np.random.rand()) * F.sum(F.softplus(-dis_real)) / batchsize / w / h
        L2 = (2+np.random.rand()) * F.sum(F.softplus(dis_fake)) / batchsize / w / h
        loss =  L1 + L2 
        chainer.report({'loss': loss}, dis)
        return loss
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号