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
评论列表
文章目录