MCPcopy Create free account
hub / github.com/JunlinHan/DCLGAN / forward

Method forward

models/fastcut_model.py:140–151  ·  view source on GitHub ↗

Run forward pass; called by both functions and .

(self)

Source from the content-addressed store, hash-verified

138 self.image_paths = input['A_paths' if AtoB else 'B_paths']
139
140 def forward(self):
141 """Run forward pass; called by both functions <optimize_parameters> and <test>."""
142 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
143 if self.opt.flip_equivariance:
144 self.flipped_for_equivariance = self.opt.isTrain and (np.random.random() < 0.5)
145 if self.flipped_for_equivariance:
146 self.real = torch.flip(self.real, [3])
147
148 self.fake = self.netG(self.real)
149 self.fake_B = self.fake[:self.real_A.size(0)]
150 if self.opt.nce_idt:
151 self.idt_B = self.fake[self.real_A.size(0):]
152
153 def compute_D_loss(self):
154 """Calculate GAN loss for the discriminator"""

Callers 2

optimize_parametersMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected