code: def main_worker(cfg):
      # create tensorboard and logs
      if cfg.DDP_CONFIG.GPU_WORLD_RANK == 0:
          tb_logdir = build_log_dir(cfg)
          writer = SummaryWriter(log_dir=tb_logdir)
      else:
          writer = None
      cfg.freeze()
  
      # create model
      model = get_model(cfg)
      model = deploy_model(model, cfg)
  
      if cfg.CONFIG.MODEL.LOAD:
          model, _ = load_model(model, cfg)
  
      # create dataset and dataloader
      test_loader = build_dataloader_test(cfg)
  
      eval_path = cfg.CONFIG.LOG.EVAL_DIR
      if not os.path.exists(eval_path):
          os.makedirs(eval_path)
      criterion = nn.CrossEntropyLoss().cuda()
  
      file = os.path.join(
          eval_path, str(cfg.DDP_CONFIG.GPU_WORLD_RANK) + ".txt"
      )
      test_classification(model, test_loader, criterion, cfg, file)
      torch.distributed.barrier()
  
      if cfg.DDP_CONFIG.GPU_WORLD_RANK == 0:
          print("Start merging results...")
          merge(eval_path, cfg)
      else:
          print(cfg.DDP_CONFIG.GPU_WORLD_RANK, "Evaluation done!")
  
file_path: gluon-cv/scripts/action-recognition/test_ddp_pytorch.py
imports: import os
  import argparse
  import numpy
  import torch
  import torch.nn
  import torch.distributed
  import torch.optim
  from tensorboardX import SummaryWriter
  from gluoncv.torch.model_zoo import get_model
  from gluoncv.torch.utils.model_utils import deploy_model, load_model
  from gluoncv.torch.data import build_dataloader_test
  from gluoncv.torch.utils.task_utils import test_classification
  from gluoncv.torch.engine.config import get_cfg_defaults
  from gluoncv.torch.engine.launch import spawn_workers
  from gluoncv.torch.utils.utils import build_log_dir
label_desc: Use image node_id 3 for calling a global function with example usage: main_worker(cfg) without return types