691e0b50d0b15665df5ec77eeec7c605c4283e1f,hypergan/trainers/alternating_trainer.py,AlternatingTrainer,_step,#AlternatingTrainer#Any#,19

Before Change


        self.g_optimizer.zero_grad()
        d_loss, g_loss = self.gan.forward_loss()
        for hook in self.train_hooks:
            loss = hook.forward()
            if loss[1] is not None:
                g_loss += loss[1]
        g_loss.mean().backward()
        self.g_optimizer.step()

After Change


        for p, np in zip(self.gan.g_parameters(), g_grads):
            p.grad = np

        if(len(g_grads) > 0):
            self.g_optimizer.step()

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

Frequency: 4

Non-data size: 3

Instances


Project Name: HyperGAN/HyperGAN
Commit Name: 691e0b50d0b15665df5ec77eeec7c605c4283e1f
Time: 2020-03-08
Author: mikkel@255bits.com
File Name: hypergan/trainers/alternating_trainer.py
Class Name: AlternatingTrainer
Method Name: _step


Project Name: pytorch/examples
Commit Name: 8a70c277c355fe734a01fe58baafdc2dc5164205
Time: 2016-12-29
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: eval


Project Name: masa-su/pixyz
Commit Name: 896014a6c0c62d4de8ccd1db7104a668a938694a
Time: 2019-05-26
Author: masa@weblab.t.u-tokyo.ac.jp
File Name: pixyz/distributions/flow_distribution.py
Class Name: TransformedDistribution
Method Name: sample