cf1ec69f7c4290f9959b1d902d35ce6d72c48995,hypergan/train_hooks/adversarial_norm_train_hook.py,AdversarialNormTrainHook,__init__,#AdversarialNormTrainHook#Any#Any#Any#,12

Before Change


    def __init__(self, gan=None, config=None, trainer=None):
        super().__init__(config=config, gan=gan, trainer=trainer)
        self.d_loss = None
        self.g_loss = None
        if self.config.gamma is not None:
            self.gamma = self.config.gamma//torch.Tensor([self.config.gamma]).float()[0].cuda()//self.gan.configurable_param(self.config.gamma or 1.0)
        if self.config.gammas is not None:
            self.gammas = [
                        self.config.gammas[0],//torch.Tensor([self.config.gammas[0]]).float()[0].cuda(),//self.gan.configurable_param(self.config.gamma or 1.0)
                        self.config.gammas[1]//torch.Tensor([self.config.gammas[1]]).float()[0].cuda()//self.gan.configurable_param(self.config.gamma or 1.0)
                    ]
        self.relu = torch.nn.ReLU()
        self.target = [Parameter(x, requires_grad=True) for x in self.gan.discriminator_real_inputs()]
        self.x_mod_target = torch.zeros_like(self.target[0])
        self.g_mod_target = torch.zeros_like(self.target[0])

    def forward(self, d_loss, g_loss):
        if self.config.mode == "real" or self.config.mode is None:

After Change


        if self.config.gammas is not None:
            self.gammas = [
                        self.config.gammas[0],//torch.Tensor([self.config.gammas[0]]).float()[0].cuda(),//self.gan.configurable_param(self.config.gamma or 1.0)
                        self.config.gammas[1]//torch.Tensor([self.config.gammas[1]]).float()[0].cuda()//self.gan.configurable_param(self.config.gamma or 1.0)
                    ]
        self.relu = torch.nn.ReLU()
        self.target = [Parameter(x, requires_grad=True) for x in self.gan.discriminator_real_inputs()]
        self.x_mod_target = torch.zeros_like(self.target[0])
        self.g_mod_target = torch.zeros_like(self.target[0])

    def forward(self, d_loss, g_loss):
        if self.config.mode == "real" or self.config.mode is None:
            for target, data in zip(self.target, self.gan.discriminator_real_inputs()):
                target.data = data.clone()
            d_fake = self.gan.d_fake
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 26

Instances


Project Name: HyperGAN/HyperGAN
Commit Name: cf1ec69f7c4290f9959b1d902d35ce6d72c48995
Time: 2020-08-22
Author: martyn@255bits.com
File Name: hypergan/train_hooks/adversarial_norm_train_hook.py
Class Name: AdversarialNormTrainHook
Method Name: __init__


Project Name: NervanaSystems/coach
Commit Name: 1aa2ab0590edb3e6e876d44ea0aeffc1c8f6d838
Time: 2018-08-27
Author: gal.leibovich@intel.com
File Name: rl_coach/base_parameters.py
Class Name: InputEmbedderParameters
Method Name: __init__


Project Name: HyperGAN/HyperGAN
Commit Name: cf1ec69f7c4290f9959b1d902d35ce6d72c48995
Time: 2020-08-22
Author: martyn@255bits.com
File Name: hypergan/train_hooks/adversarial_norm_train_hook.py
Class Name: AdversarialNormTrainHook
Method Name: __init__


Project Name: dmlc/dgl
Commit Name: 69f5869f3b6d190ed99e156a932634393ab361dd
Time: 2020-08-12
Author: xiaotj1990327@gmail.com
File Name: python/dgl/nn/pytorch/conv/sageconv.py
Class Name: SAGEConv
Method Name: __init__