class_docstr: Allows measuring model robustness for a given attack or set of attacks. This class
  can be used with any metric(s) as well as any set of attacks, either based on
  attacks / perturbations from captum.robust such as FGSM or PGD or external
  augmentation methods or perturbations such as torchvision transforms.
docstr: This method reformats a given summary; particularly for tuples,
  the Summarizer's summary format is a list of dictionaries,
  each containing the summary for the corresponding elements.
  We reformat this to return a dictionary with tuples containing
  the summary results.
docstr_tok: ["This","method","reformats","a","given","summary",";","particularly","for","tuples",",","the","Summarizer","'s","summary","format","is","a","list","of","dictionaries",",","each","containing","the","summary","for","the","corresponding","elements",".","We","reformat","this","to","return","a","dictionary","with","tuples","containing","the","summary","results","."]
code: def _format_summary(
      self, summary: Union[Dict, List[Dict]]
  ) -> Dict[str, MetricResultType]:
      r"""
      This method reformats a given summary; particularly for tuples,
      the Summarizer's summary format is a list of dictionaries,
      each containing the summary for the corresponding elements.
      We reformat this to return a dictionary with tuples containing
      the summary results.
      """
      if isinstance(summary, dict):
          return summary
      else:
          summary_dict: Dict[str, Tuple] = {}
          for key in summary[0]:
              summary_dict[key] = tuple(s[key] for s in summary)
              if self.out_format:
                  summary_dict[key] = self.out_format(
                      *summary_dict[key]
                  )
          return summary_dict
  
imports: import warnings
  from collections import namedtuple
  from typing import Any, Callable, cast, Dict, Generic, List, NamedTuple, Optional, Tuple, TypeVar, Union
  from captum._utils.common import _expand_additional_forward_args, _format_additional_forward_args, _reduce_list
  from captum.attr import Max, Mean, Min, Summarizer
  from captum.log import log_usage
  from captum.robust._core.perturbation import Perturbation
  from torch import Tensor
label_desc: Use image node_id 3 for calling the AttackComparator obj's underlying member method code with example usage: obj._format_summary(summary) and returns: summary, summary_dict