174ff6fbaaef8678313f8722690c5db4bbe58ae9,hypergan/trainers/simultaneous_trainer.py,SimultaneousTrainer,_step,#SimultaneousTrainer#Any#,26

Before Change



        G = self.gan.generator(self.gan.latent.sample())
        D = self.gan.discriminator
        d_real = D(self.gan.inputs.next()[0])
        d_fake = D(G)

        criterion = torch.nn.BCEWithLogitsLoss()
        g_loss = criterion(d_fake, torch.ones_like(d_fake))
        d_loss = criterion(d_real, torch.ones_like(d_real)) + criterion(d_fake, torch.zeros_like(d_fake))

        //d_loss, g_loss = loss.sample

        //g_loss.mean().backward(retain_graph=True)

After Change


        g_loss.mean().backward(retain_graph=True)
        self.optimizer.step()
        self.optimizer.zero_grad()
        d_loss.mean().backward()

        if self.current_step % 10 == 0:
            self.print_metrics(self.current_step)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: HyperGAN/HyperGAN
Commit Name: 174ff6fbaaef8678313f8722690c5db4bbe58ae9
Time: 2020-02-07
Author: martyn@255bits.com
File Name: hypergan/trainers/simultaneous_trainer.py
Class Name: SimultaneousTrainer
Method Name: _step


Project Name: pytorch/fairseq
Commit Name: 8bafae2ee7044529543768eec63d8460d894f5c6
Time: 2017-10-19
Author: myleott@fb.com
File Name: fairseq/multiprocessing_trainer.py
Class Name: MultiprocessingTrainer
Method Name: _async_train_step