6436259ca4542e030697c05a72c942aa9aa3ced8,sonnet/src/rmsprop.py,RMSProp,apply,#RMSProp#Any#Any#,90

Before Change


        momentum = tf.cast(self.momentum, update.dtype.base_dtype)
        epsilon = tf.cast(self.epsilon, update.dtype.base_dtype)

        if self.centered:
          tf.raw_ops.ResourceApplyCenteredRMSProp(
              var=parameter.handle,
              mg=mg.handle,
              ms=ms.handle,
              mom=mom.handle,
              lr=learning_rate,
              rho=decay,
              momentum=momentum,
              epsilon=epsilon,
              grad=update)
        else:
          tf.raw_ops.ResourceApplyRMSProp(
              var=parameter.handle,
              ms=ms.handle,
              mom=mom.handle,
              lr=learning_rate,
              rho=decay,
              momentum=momentum,
              epsilon=epsilon,
              grad=update)


class ReferenceRMSProp(base.Module):
  Reference version of the RMSProp module.

  See: http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf

After Change


        epsilon = tf.cast(self.epsilon, update.dtype.base_dtype)

        ms.assign(tf.square(update) * (1. - decay) + ms * decay)
        if self.centered:
          mg.assign(update * (1. - decay) + mg * decay)
          denominator = ms - mg + epsilon
        else:
          denominator = ms + epsilon
        mom.assign(momentum * mom + (
            learning_rate * update * tf.math.rsqrt(denominator)))
        parameter.assign_sub(mom)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: deepmind/sonnet
Commit Name: 6436259ca4542e030697c05a72c942aa9aa3ced8
Time: 2019-06-21
Author: petebu@google.com
File Name: sonnet/src/rmsprop.py
Class Name: RMSProp
Method Name: apply


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: deepmind/sonnet
Commit Name: 484ffb3eae65a09c717a6c823dcc888d5750df6c
Time: 2019-10-16
Author: tomhennigan@google.com
File Name: sonnet/src/momentum.py
Class Name: Momentum
Method Name: apply