59c218f559388be1613f4bc6c29b5dd5cc79df9d,research/deeplab/train.py,,_train_deeplab_model,#Any#Any#Any#,334

Before Change


  optimizer = tf.train.MomentumOptimizer(learning_rate, FLAGS.momentum)

  tower_grads = []
  tower_summaries = None
  for i in range(FLAGS.num_clones):
    with tf.device("/gpu:%d" % i):
      with tf.name_scope("clone_%d" % i) as scope:
        loss = _tower_loss(
            iterator=iterator,
            num_of_classes=num_of_classes,
            ignore_label=ignore_label,
            scope=scope,
            reuse_variable=(i != 0))
        grads = optimizer.compute_gradients(loss)
        tower_grads.append(grads)

        // Retain the summaries from the first tower.
        if not i:
          tower_summaries = tf.summary.merge_all(scope=scope)

  with tf.device("/cpu:0"):
    grads_and_vars = _average_gradients(tower_grads)
    if tower_summaries is not None:
      summaries.append(tower_summaries)

    // Modify the gradients for biases and last layer variables.
    last_layers = model.get_extra_layer_scopes(
        FLAGS.last_layers_contain_logits_only)

After Change


  for i in range(FLAGS.num_clones):
    with tf.device("/gpu:%d" % i):
      name_scope = ("clone_%d" % i) if i else ""
      with tf.name_scope(name_scope) as scope:
        grads = optimizer.compute_gradients(tower_losses[i])
        tower_grads.append(grads)

  with tf.device("/cpu:0"):
    grads_and_vars = _average_gradients(tower_grads)

    // Modify the gradients for biases and last layer variables.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: tensorflow/models
Commit Name: 59c218f559388be1613f4bc6c29b5dd5cc79df9d
Time: 2019-05-06
Author: YknZhu@users.noreply.github.com
File Name: research/deeplab/train.py
Class Name:
Method Name: _train_deeplab_model


Project Name: tensorflow/benchmarks
Commit Name: c48128868e7edcbf354ff79fa29fa0b79740b2f4
Time: 2018-07-18
Author: reedwm@google.com
File Name: scripts/tf_cnn_benchmarks/benchmark_cnn.py
Class Name: BenchmarkCNN
Method Name: _build_fetches


Project Name: dpressel/mead-baseline
Commit Name: 19d2bbc7d6e70836f34b83ac7702a0477e4b97b0
Time: 2019-11-19
Author: blester125@gmail.com
File Name: python/eight_mile/tf/layers.py
Class Name: BiLSTMEncoder1
Method Name: call