code: def _iter_tensors(tensor: Any) -> Any:
      """Recursively iterate over all the tensors.
  
      This is kept for complex outputs (like dicts / lists).
      However, complex outputs are not supported by PyTorch backward hooks yet.
      """
      if isinstance(tensor, torch.Tensor):
          yield tensor
      elif isinstance(tensor, (list, tuple)):
          for t in tensor:
              yield from _iter_tensors(t)
      elif isinstance(tensor, dict):
          for t in tensor.values():
              yield from _iter_tensors(t)
  
imports: from __future__ import annotations
  from typing import Any, cast
  import torch
  import torch.nn
  from nni.mutable import Categorical, Mutable, Sample, SampleValidationError, MutableExpression, label_scope, auto_label
  from nni.nas.nn.pytorch import Repeat, recursive_freeze
  from .base import BaseSuperNetModule
  from .differentiable import DifferentiableMixedLayer, DifferentiableMixedInput
  from ._expression_utils import traverse_all_options
label_desc: Use image node_id 2 for calling a global function with example usage: _iter_tensors(tensor) without return types