code: def tuple_metric(model_out: Tensor, target: int, named_tuple=False):
      _, pred = torch.max(model_out, dim=1)
      acc = (pred == target).float()
      output = model_out[:, target]
      if named_tuple:
          return ModelResult(
              accuracy=acc.item() if acc.numel() == 1 else acc,
              output=output.item() if output.numel() == 1 else output,
          )
      return (acc, output)
  
imports: import collections
  from typing import List
  import torch
  from captum.robust import AttackComparator, FGSM
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModel, BasicModel_MultiLayer
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: tuple_metric(model_out, target, named_tuple) and returns: acc,  output, ModelResult