code: def _to_tuple(t: Tensor) -> Tuple:
      """Convert a tensor into a nested tuple.
  
      Args:
          t: The tensor to convert.
  
      Returns:
          A nested tuple with the same content.
  
      """
      return _nested_tuple(t.tolist())
  
file_path: torchmetrics/src/torchmetrics/functional/detection/_panoptic_quality_common.py
imports: from typing import Collection, Dict, Iterator, List, Optional, Set, Tuple, cast
  import torch
  from torch import Tensor
  from torchmetrics.utilities import rank_zero_warn
label_desc: Use image node_id 2 for calling a global function with example usage: _to_tuple(t) and returns: _nested_tuple