cb556a585da0b65d28d2fc7d52c3851ac1a7d369,open_seq2seq/utils/utils.py,,get_results_for_epoch,#Any#Any#Any#Any#Any#,202

Before Change



    if compute_loss:
      total_samples_all = MPI.COMM_WORLD.gather(total_samples)
      total_loss_all = MPI.COMM_WORLD.gather(total_loss)
    results_per_batch_all = MPI.COMM_WORLD.gather(results_per_batch)

    MPI.COMM_WORLD.Barrier()
    if MPI.COMM_WORLD.Get_rank() != 0:
      // returning dummy tuple of correct shape
      if compute_loss:
        return None, None
      else:
        return None

    if compute_loss:
      total_loss = np.sum(total_loss_all)
      total_samples = np.sum(total_samples_all)
    // moving GPU dimension into the batch dimension
    results_per_batch = [item for sl in results_per_batch_all for item in sl]

  if compute_loss:
    total_loss /= total_samples
    return results_per_batch, total_loss

  return results_per_batch

After Change


    )

  if compute_loss:
    total_samples = collect_if_horovod(total_samples, model.hvd, "sum")
    total_loss = collect_if_horovod(total_loss, model.hvd, "sum")
  results_per_batch = collect_if_horovod(results_per_batch, model.hvd, "gather")

  if results_per_batch is None:
    // returning dummy tuple of correct shape if not in master worker
    if compute_loss:
      return None, None
    else:
      return None

  if compute_loss:
    return results_per_batch, total_loss / total_samples
  else:
    return results_per_batch

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 10

Instances


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: cb556a585da0b65d28d2fc7d52c3851ac1a7d369
Time: 2018-05-30
Author: igor.a.gitman@gmail.com
File Name: open_seq2seq/utils/utils.py
Class Name:
Method Name: get_results_for_epoch


Project Name: shenweichen/DeepCTR
Commit Name: 8182ea386e6529a1a2294d8e2d33fc040d0cbfb2
Time: 2019-07-21
Author: wcshen1994@163.com
File Name: deepctr/inputs.py
Class Name:
Method Name: get_linear_logit


Project Name: OpenNMT/OpenNMT-py
Commit Name: 685126644ae540be72eb662527269a0395e2c9eb
Time: 2017-09-05
Author: bpeters@coli.uni-saarland.de
File Name: onmt/IO.py
Class Name:
Method Name: make_features


Project Name: NifTK/NiftyNet
Commit Name: 135a56e0935fbb04811f8ce7b9f514f498212f71
Time: 2018-07-25
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/layer/crf.py
Class Name:
Method Name: ftheta