code: def update(self, new_metrics):
      if not self.is_updated:
          self.metric_dict = {}
  
      for key in new_metrics:
          if key in self.metric_dict:
              # top1, top5 and ips are "larger is better"
              if key in ["top1", "top5", "ips"]:
                  self.metric_dict[key] = (
                      new_metrics[key]
                      if new_metrics[key] > self.metric_dict[key]
                      else self.metric_dict[key]
                  )
              # Others are "Smaller is better"
              else:
                  self.metric_dict[key] = (
                      new_metrics[key]
                      if new_metrics[key] < self.metric_dict[key]
                      else self.metric_dict[key]
                  )
          else:
              self.metric_dict[key] = new_metrics[key]
  
file_path: DALI/docs/examples/use_cases/paddle/resnet50/train.py
imports: import logging
  import os
  from dali import build_dataloader
  from utils.affinity import set_cpu_affinity
  from utils.config import parse_args, print_args
  from utils.logger import setup_dllogger
  from utils.mode import Mode, RunScope
  from utils.save_load import init_program, save_model
  import paddle
  import program
  from paddle.distributed import fleet
  from paddle.static.amp.fp16_lists import AutoMixedPrecisionLists
  from paddle.static.amp.fp16_utils import cast_model_to_fp16
  from paddle.incubate import asp
label_desc: Use image node_id 2 for calling the MetricSummary obj's underlying member method code with example usage: obj.update(new_metrics) without return types