mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Previously, unbacked SymInts would gradually get larger and larger as we kept rebinding them. Now, we do the replacement to preserve the old symbol. Actually doing this is a bit tricky. Here’s the order things happen when retracing data dependent: 1. Run fake tensor prop: allocate new unbacked SymInt 2. Run proxy tensor mode, calculate bindings and associate them with FX node 3. Run PropagateUnbackedSymInts, rename unbacked bindings to their old ones so they are consistent So the problem is when we calculate bindings in step (2), we don't know what the original names are yet, we only find out later at (3). But by the time (3) runs, we've already stuffed some new bindings in meta["unbacked_bindings"] and we don't know how to update them! To fix this, I introduce resolve_unbacked_bindings which post facto applies any of the renamings we discovered in (3). Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/124782 Approved by: https://github.com/lezcano ghstack dependencies: #124310, #124314, #124316, #124394, #124739
53 lines
1.1 KiB
ReStructuredText
53 lines
1.1 KiB
ReStructuredText
.. currentmodule:: torch.fx.experimental
|
|
|
|
torch.fx.experimental
|
|
=====================
|
|
|
|
.. warning::
|
|
These APIs are experimental and subject to change without notice.
|
|
|
|
torch.fx.experimental.symbolic_shapes
|
|
-------------------------------------
|
|
.. currentmodule:: torch.fx.experimental.symbolic_shapes
|
|
.. automodule:: torch.fx.experimental.symbolic_shapes
|
|
|
|
.. autosummary::
|
|
:toctree: generated
|
|
:nosignatures:
|
|
|
|
ShapeEnv
|
|
DimDynamic
|
|
StrictMinMaxConstraint
|
|
RelaxedUnspecConstraint
|
|
EqualityConstraint
|
|
SymbolicContext
|
|
StatelessSymbolicContext
|
|
StatefulSymbolicContext
|
|
SubclassSymbolicContext
|
|
DimConstraints
|
|
ShapeEnvSettings
|
|
ConvertIntKey
|
|
CallMethodKey
|
|
PropagateUnbackedSymInts
|
|
DivideByKey
|
|
|
|
hint_int
|
|
is_concrete_int
|
|
is_concrete_bool
|
|
has_free_symbols
|
|
definitely_true
|
|
definitely_false
|
|
guard_size_oblivious
|
|
parallel_or
|
|
parallel_and
|
|
sym_eq
|
|
constrain_range
|
|
constrain_unify
|
|
canonicalize_bool_expr
|
|
statically_known_true
|
|
lru_cache
|
|
check_consistent
|
|
compute_unbacked_bindings
|
|
rebind_unbacked
|
|
resolve_unbacked_bindings
|