code: def metric_average(val, name):
      tensor = torch.tensor(val)
      if args.cuda:
          tensor = tensor.cuda()
      avg_tensor = bps.push_pull(tensor, name=name)
      return avg_tensor.item()
  
file_path: byteps/example/pytorch/train_mnist_byteps.py
imports: from __future__ import print_function
  import argparse
  import os
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from torchvision import datasets, transforms
  import torch.utils.data.distributed
  import byteps.torch
label_desc: Use image node_id 2 for calling a global function with example usage: metric_average(val, name) and returns: avg_tensor