840e02d43c5724847f767d6bc82981b3aed5eaa6,hypergan/train_hooks/gradient_penalty_train_hook.py,GradientPenaltyTrainHook,forward,#GradientPenaltyTrainHook#,17
Before Change
d = self.gan.discriminator(interpolated)
grad = torch_grad(outputs=d, inputs=interpolated,
grad_outputs=torch.ones(d.size()).cuda() ,
create_graph=True, retain_graph=True)[0]
grad = grad.view(self.gan.batch_size(), -1)
After Change
grad = torch_grad(outputs=d.mean(), inputs=parameters, create_graph=True, retain_graph=True)
grad = [_g.view(-1) for _g in grad]
grad_loss = [((torch.sqrt(torch.sum(_g**2, dim=0) +1e-12) - 1) ** 2).mean() for _g in grad]
grad_loss = sum(grad_loss)
loss = gamma*grad_loss
return [loss, loss]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: HyperGAN/HyperGAN
Commit Name: 840e02d43c5724847f767d6bc82981b3aed5eaa6
Time: 2020-02-08
Author: mikkel@255bits.com
File Name: hypergan/train_hooks/gradient_penalty_train_hook.py
Class Name: GradientPenaltyTrainHook
Method Name: forward
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 44149da8e5a52f9fd97ebc6ada9ff821241a995a
Time: 2018-07-31
Author: boris.ilpossente@hotmail.it
File Name: mushroom/approximators/parametric/pytorch_network.py
Class Name: PyTorchApproximator
Method Name: fit
Project Name: facebookresearch/ParlAI
Commit Name: 72e28f315e6458993407beb4d7041ccebca90735
Time: 2018-10-16
Author: bhancock@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: _build_candidates