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


        if "components" in self.config:
            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
    self.target = target
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

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/kfac
Commit Name: aa5f9ddfdf0447c7a53f4e2676a1c866189315cd
Time: 2019-02-01
Author: jamesmartens@google.com
File Name: kfac/python/ops/curvature_matrix_vector_products.py
Class Name: CurvatureMatrixVectorProductComputer
Method Name: _total_loss