code: def Dim(
      name: str, *, min: Optional[int] = None, max: Optional[int] = None
  ):
      """
      :func:`Dim` constructs a type analogous to a named symbolic integer with a range.
      It can be used to describe multiple possible values of a dynamic tensor dimension.
      Note that different dynamic dimensions of the same tensor, or of different tensors,
      can be described by the same type.
  
      Args:
          name (str): Human-readable name for debugging.
          min (Optional[int]): Minimum possible value of given symbol (inclusive)
          max (Optional[int]): Maximum possible value of given symbol (inclusive)
  
      Returns:
          A type that can be used in dynamic shape specifications for tensors.
      """
      _min = 2 if min is None else builtins.max(min, 2)
      _max = (
          sys.maxsize - 1
          if max is None
          else builtins.min(max, sys.maxsize - 1)
      )
      assert (
          _max > _min
      ), f"Cannot create Dim with inconsistent min={min}, max={max}"
      dim = _Dim(name, (int,), {"min": _min, "max": _max})
      dim.__module__ = getattr(
          inspect.getmodule(inspect.stack()[1][0]),
          "__name__",
          "__main__",
      )
      return dim
  
imports: import builtins
  import dataclasses
  import inspect
  import math
  import sys
  import weakref
  from collections import defaultdict
  from typing import Any, Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import torch
  from torch._subclasses.fake_tensor import FakeTensor
  from .exported_program import ExportedProgram
label_desc: Use image node_id 1 for calling a global function with example usage: Dim(name) and returns: dim