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

Before Change


        for hook in self.train_hooks:
            loss = hook.forward()
            if loss[0] is not None:
                d_loss += loss[0]


        d_loss.mean().backward()
        self.d_optimizer.step()

        self.g_optimizer.zero_grad()
        d_loss, g_loss = self.gan.forward_loss()

After Change


        d_grads, _ = self.calculate_gradients(["d"])

        for hook in self.train_hooks:
            d_grads, _ = hook.gradients(d_grads, _)
        for p, np in zip(self.gan.d_parameters(), d_grads):
            p.grad = np
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: facebookresearch/Horizon
Commit Name: 4d68a1e4435dfeb5884093aa91a33e1b34a909cc
Time: 2019-02-13
Author: kittipat@fb.com
File Name: ml/rl/training/_dqn_trainer.py
Class Name: _DQNTrainer
Method Name: train


Project Name: rusty1s/pytorch_geometric
Commit Name: 455a0dc9a98212089a7201a025670c33a1770f67
Time: 2017-10-23
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/functional/spline_gcn_test.py
Class Name: SplineGcnTest
Method Name: test_backward