code: def create_fetchs(
      out, feeds, class_num, label_smoothing=0, mode=Mode.TRAIN
  ):
      """
      Create fetchs to obtain specific outputs from Pragrm execution (included loss and measures).
  
      Args:
          out(variable): The model output variable.
          feeds(dict): A dict of mapping variables'name to their values
                       (The input of Program execution).
          class_num(int): The number of classes.
          label_smoothing(float, optional): Epsilon of label smoothing. Default: 0.
          mode(utils.Mode, optional): Train or eval mode. Default: Mode.TRAIN
      Returns:
          fetchs(dict): A dict of outputs from Program execution (included loss and measures).
                        key (string): Name of variable to fetch.
                        Value (tuple): (variable, AverageMeter).
      """
      fetchs = dict()
      target = paddle.reshape(feeds["label"], [-1, 1])
  
      if mode == Mode.TRAIN:
          if label_smoothing == 0:
              loss = F.cross_entropy(out, target)
          else:
              label_one_hot = F.one_hot(target, class_num)
              soft_target = F.label_smooth(
                  label_one_hot, epsilon=label_smoothing
              )
              soft_target = paddle.reshape(
                  soft_target, shape=[-1, class_num]
              )
              log_softmax = -F.log_softmax(out, axis=-1)
              loss = paddle.sum(log_softmax * soft_target, axis=-1)
      else:
          loss = F.cross_entropy(out, target)
          label = paddle.argmax(out, axis=-1, dtype="int32")
          fetchs["label"] = (label, None)
  
      loss = loss.mean()
  
      fetchs["loss"] = (
          loss,
          AverageMeter("loss", "7.4f", need_avg=True),
      )
  
      acc_top1 = paddle.metric.accuracy(input=out, label=target, k=1)
      acc_top5 = paddle.metric.accuracy(input=out, label=target, k=5)
      metric_dict = dict()
      metric_dict["top1"] = acc_top1
      metric_dict["top5"] = acc_top5
  
      for key in metric_dict:
          if (
              mode != Mode.TRAIN
              and paddle.distributed.get_world_size() > 1
          ):
              paddle.distributed.all_reduce(
                  metric_dict[key], op=paddle.distributed.ReduceOp.SUM
              )
              metric_dict[key] = (
                  metric_dict[key] / paddle.distributed.get_world_size()
              )
  
          fetchs[key] = (
              metric_dict[key],
              AverageMeter(key, "7.4f", need_avg=True),
          )
  
      return fetchs
  
imports: import time
  import logging
  from profile import Profiler
  import numpy
  from optimizer import build_optimizer
  from lr_scheduler import build_lr_scheduler
  from utils.misc import AverageMeter
  from utils.mode import Mode, RunScope
  from utils.utility import get_num_trainers
  import models
  import dllogger
  import paddle
  import paddle.nn.functional
  from paddle.distributed import fleet
  from paddle.distributed.fleet import DistributedStrategy
  from paddle.incubate import asp
  from paddle.distributed.fleet.meta_optimizers.common import CollectiveHelper
label_desc: Use image node_id 2 for calling a global function with example usage: create_fetchs(out, feeds, class_num, label_smoothing, mode) and returns: fetchs