class_docstr: .. warning::
      Do not construct :class:`Constraint` directly, use :func:`dynamic_dim` instead.
  
  This represents constraints on input tensor dimensions, e.g., requiring
  them to be fully polymorphic or within some range.
class_docstr_tok: ["..","warning",":",":","Do","not","construct",":","class",":","`","Constraint","`","directly",",","use",":","func",":","`","dynamic_dim","`","instead",".","This","represents","constraints","on","input","tensor","dimensions",",","e.g.",",","requiring","them","to","be","fully","polymorphic","or","within","some","range","."]
code: def _clone_with_range(self, lower=2, upper=math.inf):
      # Import sympy locally
      from torch.fx.experimental.symbolic_shapes import (
          StrictMinMaxConstraint,
      )
      from torch.utils._sympy.value_ranges import ValueRanges
  
      constraint_range = StrictMinMaxConstraint(
          vr=self.constraint_range.vr
          & ValueRanges(lower=lower, upper=upper),
          warn_only=False,
      )
      return _create_constraint(
          self.w_tensor,
          self.t_id,
          self.dim,
          constraint_range,
          self.shared,
          self.debug_name,
      )
  
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 the Constraint obj's underlying member method code with example usage: obj._clone_with_range(lower, upper) and returns: _create_constraint