code: def _average_gradients(model):
      # Gradient averaging.
      size = float(dist.get_world_size())
      for param in model.parameters():
          dist.all_reduce(
              param.grad.data, op=dist.reduce_op.SUM, group=0
          )
          param.grad.data /= size
  
imports: import argparse
  import json
  import logging
  import os
  import sys
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torch.utils.data
  import torch.utils.data.distributed
  from torchvision import datasets, transforms
label_desc: Use image node_id 3 for calling a global function with example usage: _average_gradients(model) without return types