You may also want to check out all available functions/classes of the module torch.nn.functional , or try the search function . Example #1Source File: __init__.py From iSeeBetter with MIT License 6 votes def _ssim(img1, img2, window, window_size, channel, size_average=True): mu1 =...
ssim_weight * SSIM(leftImage, leftImage_fromWarp, leftMask) if rightMask is None: rightMask = torch.ones_like(rightImage > 0) loss += self.rms_weight * self.rms(rightImage[rightMask], rightImage_fromWarp[rightMask]) loss += self.ssim_weight * SSIM(rightImage, rightImage_fromWarp, ...
nn.functional.log_softmax(logit, dim=1) logit = logit.view(self.n_sample, batch_sz, self.vocab_size) flatten_x = x.unsqueeze(0).expand(self.n_sample, batch_sz, self.vocab_size) error = torch.mul(flatten_x, logit) error = torch.mean(error, dim=0) recon_loss = -torch.sum(...