mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-11 22:34:53 +08:00
[symbolic shapes][compile-time] Minor compile time optimization in has_free_symbols (#122144)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/122144 Approved by: https://github.com/lezcano ghstack dependencies: #120726
This commit is contained in:
committed by
PyTorch MergeBot
parent
c2eedb7f8a
commit
1686e2d1e4
@ -280,15 +280,15 @@ def _iterate_exprs(val: Union[SymInt, torch.Tensor]) -> Iterable[sympy.Basic]:
|
||||
yield val
|
||||
elif isinstance(val, (int, float, bool)):
|
||||
pass
|
||||
elif is_sparse_any(val):
|
||||
yield from _iterate_exprs(val.size())
|
||||
elif isinstance(val, (tuple, list)):
|
||||
for s in val:
|
||||
yield from _iterate_exprs(s)
|
||||
elif isinstance(val, torch.Tensor):
|
||||
yield from _iterate_exprs(val.size())
|
||||
yield from _iterate_exprs(val.stride())
|
||||
yield from _iterate_exprs(val.storage_offset())
|
||||
elif isinstance(val, (tuple, list)):
|
||||
for s in val:
|
||||
yield from _iterate_exprs(s)
|
||||
elif is_sparse_any(val):
|
||||
yield from _iterate_exprs(val.size())
|
||||
elif val is None:
|
||||
pass
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user