e9e215c2f7ca0bbbded08d34c834c2a3f43bb8d0,pro_gan_pytorch/Losses.py,WGAN_GP,__gradient_penalty,#WGAN_GP#Any#Any#Any#Any#Any#,109

Before Change



        // create the merge of both real and fake samples
        merged = epsilon * real_samps + ((1 - epsilon) * fake_samps)
        merged = merged.cuda(fake_samps.device)
        merged = th.autograd.Variable(merged, requires_grad=True)

        // forward pass
        op = self.dis(merged, height, alpha)

After Change



        // perform backward pass from op to merged for obtaining the gradients
        gradient = th.autograd.grad(outputs=op, inputs=merged,
                                    grad_outputs=th.ones_like(op), create_graph=True,
                                    retain_graph=True, only_inputs=True)[0]

        // calculate the penalty using these gradients
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: akanimax/pro_gan_pytorch
Commit Name: e9e215c2f7ca0bbbded08d34c834c2a3f43bb8d0
Time: 2019-01-09
Author: akanimax@gmail.com
File Name: pro_gan_pytorch/Losses.py
Class Name: WGAN_GP
Method Name: __gradient_penalty


Project Name: kymatio/kymatio
Commit Name: 9ec51b207165d135d34bedfc69049909861bd4be
Time: 2019-03-03
Author: janden@flatironinstitute.org
File Name: kymatio/scattering1d/tests/test_utils.py
Class Name:
Method Name: test_modulus


Project Name: pytorch/tutorials
Commit Name: 0ad33d606682537466f3430fc6d6ac7d47460f1a
Time: 2018-04-24
Author: soumith@gmail.com
File Name: beginner_source/blitz/tensor_tutorial.py
Class Name:
Method Name: