4d3848ea2a2b22ad9d9a8364061e8ffc83b91dae,hypergan/gans/ali_gan.py,AliGAN,regularize_gradient_norm,#AliGAN#Any#,77

Before Change


        d1_z_grads = torch_grad(outputs=loss, inputs=z, retain_graph=True)

        d1_norm = [torch.norm(_d1_grads.view(-1).cuda(),p=2,dim=0) for _d1_grads in d1_grads]
        d1_z_norm = [torch.norm(_d1_grads.reshape(-1).cuda(),p=2,dim=0) for _d1_grads in d1_z_grads]

        reg_d1 = [((_d1_norm**2).cuda()) for _d1_norm in d1_norm]
        reg_d1 += [((_d1_norm**2).cuda()) for _d1_norm in d1_z_norm]

After Change



    def regularize_gradient_norm(self, calculate_loss):
        x = Variable(self.x, requires_grad=True).cuda()
        d1_logits = self.discriminator(x, context={"z":self.z})
        d2_logits = self.d_fake

        loss = calculate_loss(d1_logits, d2_logits)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 2

Instances


Project Name: HyperGAN/HyperGAN
Commit Name: 4d3848ea2a2b22ad9d9a8364061e8ffc83b91dae
Time: 2020-02-14
Author: mikkel@255bits.com
File Name: hypergan/gans/ali_gan.py
Class Name: AliGAN
Method Name: regularize_gradient_norm


Project Name: nipy/dipy
Commit Name: 7a2302a8e8cfc462a6e427225ea40ebaf99066c4
Time: 2015-09-13
Author: arokem@gmail.com
File Name: dipy/core/sphere.py
Class Name:
Method Name: interp_rbf


Project Name: cornellius-gp/gpytorch
Commit Name: c63cc933782e2de32c9fe74c18b337b2bbe0f242
Time: 2018-07-19
Author: jrg365@cornell.edu
File Name: test/examples/test_kissgp_variational_regression.py
Class Name: TestKissGPVariationalRegression
Method Name: test_kissgp_gp_mean_abs_error


Project Name: rail-berkeley/softlearning
Commit Name: af0e6f3f752607bad264b543a89c236b3a5240e3
Time: 2018-05-22
Author: kristian.hartikainen@gmail.com
File Name: examples/variants.py
Class Name:
Method Name: