mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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. Resolves #126888 - #126888 This PR is split from PR #126898. - #126898 ------ Pull Request resolved: https://github.com/pytorch/pytorch/pull/127689 Approved by: https://github.com/Skylion007
24 lines
698 B
Python
24 lines
698 B
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
import warnings
|
|
|
|
# TODO: remove this file when the migration of the pytree utility is done
|
|
from torch.utils._pytree import tree_map_, treespec_pprint
|
|
|
|
|
|
__all__ = ["tree_map_", "treespec_pprint"]
|
|
|
|
|
|
with warnings.catch_warnings():
|
|
warnings.simplefilter("always")
|
|
warnings.warn(
|
|
"`torch._functorch.pytree_hacks` is deprecated and will be removed in a future release. "
|
|
"Please `use torch.utils._pytree` instead.",
|
|
DeprecationWarning,
|
|
stacklevel=2,
|
|
)
|