original_docstring: Calculate GAN and L1 loss for the generator
docstring: Calculate GAN and L1 loss for the generator
docstring_tokens: Calculate GAN and L1 loss for the generator
code: def backward_G(self):
          """Calculate GAN and L1 loss for the generator"""
          # First, G(A) should fake the discriminator
          fake_AB = torch.cat((self.real_A, self.fake_B), 1)
          pred_fake = self.netD(self.netF(self.real_A), self.netF(self.fake_B))
          self.loss_G_GAN = self.criterionGAN(pred_fake, True)
          # Second, G(A) = B
          self.loss_G_L1 = self.criterionL1(self.fake_B, self.real_B) * self.opt.lambda_L1
          # combine loss and calculate gradients
          self.loss_G = self.loss_G_GAN + self.loss_G_L1
          self.loss_G.backward()
code_tokens: def backward_G ( self ) : fake_AB = torch . cat ( ( self . real_A , self . fake_B ) , 1 ) pred_fake = self . netD ( self . netF ( self . real_A ) , self . netF ( self . fake_B ) ) self . loss_G_GAN = self . criterionGAN ( pred_fake , True ) self . loss_G_L1 = self . criterionL1 ( self . fake_B , self . real_B ) * self . opt . lambda_L1 self . loss_G = self . loss_G_GAN + self . loss_G_L1 self . loss_G . backward ( )
short_docstring: Calculate GAN and L1 loss for the generator
short_docstring_tokens: Calculate GAN and L1 loss for the generator
comment: """Calculate GAN and L1 loss for the generator"""$SEP$# First, G(A) should fake the discriminator
  $SEP$# Second, G(A) = B
  $SEP$# combine loss and calculate gradients
  