mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE] wrap deprecated function/class with typing_extensions.deprecated (#126898)
Use `typing_extensions.deprecated` for deprecation annotation if possible. Otherwise, add `category=FutureWarning` to `warnings.warn("message")` if the category is missing.
Note that only warnings that their messages contain `[Dd]eprecat(ed|ion)` are updated in this PR.
UPDATE: Use `FutureWarning` instead of `DeprecationWarning`.
Resolves #126888
- #126888
Pull Request resolved: https://github.com/pytorch/pytorch/pull/126898
Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
699db7988d
commit
749a132fb0
@ -359,9 +359,12 @@ def to_sparse_semi_structured(
|
||||
[-4370, -4370, -4370, ..., -4370, -4370, -4370]], device='cuda:0', dtype=torch.int16))
|
||||
"""
|
||||
if transposed:
|
||||
raise DeprecationWarning(
|
||||
"Setting transpose from to_sparse_semi_structured is deprecated and will be removed in a future release."
|
||||
"SparseSemiStructuredTensor only support contiguous input tensors. "
|
||||
warnings.warn(
|
||||
"Setting transpose from `to_sparse_semi_structured` is deprecated "
|
||||
"and will be removed in a future release. "
|
||||
"`SparseSemiStructuredTensor` only support contiguous input tensors.",
|
||||
FutureWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
# set from _FORCE_CUTLASS flag
|
||||
|
||||
Reference in New Issue
Block a user