updater.py 文件源码

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

项目:chainer-pix2pix 作者: wuhuikai 项目源码 文件源码
def loss_G(self, real_B, fake_B, fake_D):
        loss_l1 = F.mean_absolute_error(real_B, fake_B)
        chainer.report({'loss_l1': loss_l1}, self.G)

        batch_size, _, h, w = fake_D.shape
        loss_D = - F.sum(F.log(fake_D + self.eps)) / (batch_size*h*w)
        chainer.report({'loss_D': loss_D}, self.G)

        loss = loss_D + self.lambd*loss_l1
        chainer.report({'loss': loss}, self.G)

        return loss
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号