code: def _summarize_elem_format(elem: Any) -> Any:
      # Get a summary of one elem
      # Helps generate human-readable error messages
  
      class _repr_object:
          # empty object is only repr
          def __init__(self, representation):
              self.representation = representation
  
          def __repr__(self):
              return self.representation
  
      if isinstance(elem, torch.Tensor):
          return _repr_object(
              "torch.Tensor(" + ", ".join(map(str, elem.shape)) + ")"
          )
      if isinstance(elem, np.ndarray):
          return _repr_object(
              "np.array(" + ", ".join(map(str, elem.shape)) + ")"
          )
      if isinstance(elem, Mapping):
          return {
              key: _summarize_elem_format(value)
              for key, value in elem.items()
          }
      if isinstance(elem, Sequence):
          return [_summarize_elem_format(value) for value in elem]
  
      # fallback to original, for cases like float, int, ...
      return elem
  
file_path: nni/nni/nas/oneshot/pytorch/supermodule/_expression_utils.py
imports: from __future__ import annotations
  import operator
  from typing import Any, TypeVar, List, cast, Mapping, Sequence, Optional, Iterable, overload
  import numpy
  import torch
  from nni.mutable import MutableExpression, Categorical
label_desc: Use image node_id 7 for calling a global function with example usage: _summarize_elem_format(elem) and returns: elem, _repr_object, _repr_object, unknown, unknown, self