Run forward pass; called by both functions and .
(self)
| 134 | self.image_paths = input['A_paths' if AtoB else 'B_paths'] |
| 135 | |
| 136 | def forward(self): |
| 137 | """Run forward pass; called by both functions <optimize_parameters> and <test>.""" |
| 138 | self.real = torch.cat((self.real_A, self.real_B), dim=0) if self.opt.nce_idt and self.opt.isTrain else self.real_A |
| 139 | if self.opt.flip_equivariance: |
| 140 | self.flipped_for_equivariance = self.opt.isTrain and (np.random.random() < 0.5) |
| 141 | if self.flipped_for_equivariance: |
| 142 | self.real = torch.flip(self.real, [3]) |
| 143 | |
| 144 | self.fake = self.netG(self.real) |
| 145 | self.fake_B = self.fake[:self.real_A.size(0)] |
| 146 | if self.opt.nce_idt: |
| 147 | self.idt_B = self.fake[self.real_A.size(0):] |
| 148 | |
| 149 | def compute_D_loss(self): |
| 150 | """Calculate GAN loss for the discriminator""" |
no outgoing calls
no test coverage detected