code: def extract_shape_info(x):
      """Extract shape information from tensors (and potentially complex data structures) returned by module forward."""
      from torch.utils._pytree import tree_map
  
      def _extract(x):
          if isinstance(x, ShapeTensor):
              return x.real_shape
          return x
  
      return tree_map(_extract, x)
  
imports: from __future__ import annotations
  import functools
  import logging
  import traceback
  from typing import Union, Tuple, Callable, Iterable, Any, NamedTuple, Dict, cast, overload
  import torch
  from torch import nn
  from torch.utils.hooks import RemovableHandle
  from nni.mutable import MutableExpression, Mutable, LabeledMutable, Sample, SampleValidationError
  from nni.mutable.mutable import _mutable_equal
  from .misc import is_leaf_module, argument_in_spec
label_desc: Use image node_id 1 for calling a global function with example usage: extract_shape_info(x) and returns: tree_map, x, x