e8b348915f3fe67d79f75c4399606821b413e5a1,sonnet/src/rmsprop_test.py,RMSPropTest,testMovingVariablesColocatedWithOriginal,#RMSPropTest#Any#,113

Before Change


    device = "GPU:0" if self.primary_device == "GPU" else "CPU:0"
    with tf.device(device):
      var = tf.Variable(1.0)
    for moving_var in optimizer._get_or_create_moving_vars(var):
      if moving_var is not None:
        self.assertEqual(moving_var.device, var.device)

if __name__ == "__main__":
  // tf.enable_v2_behavior()
  tf.test.main()

After Change


    optimizer = opt_class(learning_rate=0.1)
    with tf.device("CPU:0"):
      var = tf.Variable(1.0)
    optimizer.apply([tf.constant(0.1)], [var])
    self.assertEqual(optimizer.mom[0].device, var.device)
    self.assertEqual(optimizer.ms[0].device, var.device)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: deepmind/sonnet
Commit Name: e8b348915f3fe67d79f75c4399606821b413e5a1
Time: 2019-05-31
Author: petebu@google.com
File Name: sonnet/src/rmsprop_test.py
Class Name: RMSPropTest
Method Name: testMovingVariablesColocatedWithOriginal


Project Name: XifengGuo/CapsNet-Keras
Commit Name: 5cb43a9498315a16412cba20a59e6e76f9721b7b
Time: 2017-10-31
Author: guoxifeng1990@163.com
File Name: capsulelayers.py
Class Name: CapsuleLayer
Method Name: call


Project Name: deepmind/sonnet
Commit Name: e8b348915f3fe67d79f75c4399606821b413e5a1
Time: 2019-05-31
Author: petebu@google.com
File Name: sonnet/src/adam_test.py
Class Name: AdamTest
Method Name: testMomentVariablesColocatedWithOriginal


Project Name: NifTK/NiftyNet
Commit Name: a0f77cc8b87512e691a7c22b6fb9ba60f603b632
Time: 2017-07-04
Author: r.gray@ucl.ac.uk
File Name: layer/reparameterization_trick.py
Class Name: ReparameterizationLayer
Method Name: layer_op