Remove allow-untyped-defs from torch.fx.experimental.symbolic_shapes (#137019)

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/137019
Approved by: https://github.com/Skylion007
ghstack dependencies: #136934, #136935, #136972
This commit is contained in:
Edward Z. Yang
2024-09-30 18:21:41 -07:00
committed by PyTorch MergeBot
parent cc8f1cddd4
commit 6bd9d37266
11 changed files with 507 additions and 418 deletions

View File

@ -19,7 +19,7 @@ from typing import (
TYPE_CHECKING,
Union,
)
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, TypeGuard
import torch
from torch._C._autograd import CreationMeta
@ -143,7 +143,7 @@ def is_sparse_compressed(t):
return isinstance(t, torch.Tensor) and is_sparse_compressed_layout(t.layout)
def is_sparse_any(t):
def is_sparse_any(t: object) -> TypeGuard[torch.Tensor]:
return is_sparse_coo(t) or is_sparse_compressed(t)