code: def join_dimensions(expr: Expr) -> Expr:
      if not isinstance(expr, sympy.Add) or not expr.has(
          ModularIndexing
      ):
          return expr  # fast exit path
      return _join_dimensions_cached(expr)
  
imports: import functools
  import itertools
  import logging
  from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Union
  import sympy
  from sympy import Expr
  from torch.fx.experimental.symbolic_shapes import ShapeEnv
  from torch.utils._sympy.functions import FloorDiv, ModularIndexing
  from torch.utils._sympy.value_ranges import bound_sympy
  from .utils import sympy_subs, sympy_symbol, VarRanges
  from .virtualized import V
label_desc: Use image node_id 1 for calling a global function with example usage: join_dimensions(expr) and returns: _join_dimensions_cached, expr