5ee0f6c5fc31124eddffedddb7c2ce816dd329c8,hypergan/train_hooks/gradient_penalty_train_hook.py,GradientPenaltyTrainHook,__init__,#GradientPenaltyTrainHook#Any#Any#Any#Any#Any#Any#,19

Before Change



    gd = tf.gradients(target, target_vars)
    gds = [tf.square(tf.norm(_gd, ord=2)) for _gd in gd if _gd is not None]
    r = tf.add_n(gds)
    self.d_loss = self.d_lambda * tf.reduce_mean(r)
    self.gan.add_metric("gp", self.d_loss)

  def losses(self):

After Change


            target_vars = []
            for component in self.config.components:
                c = getattr(gan, component)
                target_vars += c.variables()
        else:
            target_vars = v.variables()

    gd = tf.gradients(target, target_vars)
    gds = [tf.square(_gd) for _gd in gd if _gd is not None]
    self.loss = tf.add_n([self.d_lambda * tf.reduce_mean(_r) for _r in gds])
    self.gds = gds
    self.gd = gd
    self.target_vars = target_vars
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: HyperGAN/HyperGAN
Commit Name: 5ee0f6c5fc31124eddffedddb7c2ce816dd329c8
Time: 2019-02-26
Author: mikkel@255bits.com
File Name: hypergan/train_hooks/gradient_penalty_train_hook.py
Class Name: GradientPenaltyTrainHook
Method Name: __init__


Project Name: reinforceio/tensorforce
Commit Name: 4ad2ca6fd75a9011527cba10186da96a86da0ddf
Time: 2018-07-27
Author: alexkuhnle@t-online.de
File Name: tensorforce/models/memory_model.py
Class Name: MemoryModel
Method Name: tf_loss


Project Name: tensorflow/benchmarks
Commit Name: abe3c808933c85e6db1719cdb92fcbbd9eac6dec
Time: 2017-08-17
Author: tobyboyd@google.com
File Name: scripts/tf_cnn_benchmarks/variable_mgr.py
Class Name:
Method Name: aggregate_gradients_using_copy


Project Name: HyperGAN/HyperGAN
Commit Name: 1c51cecde6aba5e6aa61158dd441326da5bb79a4
Time: 2018-06-18
Author: martyn@255bits.com
File Name: hypergan/trainers/evolution_trainer.py
Class Name: EvolutionTrainer
Method Name: _create