pytree_hacks.py 698 B

1234567891011121314151617181920212223
  1. # Copyright (c) Facebook, Inc. and its affiliates.
  2. # All rights reserved.
  3. #
  4. # This source code is licensed under the BSD-style license found in the
  5. # LICENSE file in the root directory of this source tree.
  6. import warnings
  7. # TODO: remove this file when the migration of the pytree utility is done
  8. from torch.utils._pytree import tree_map_, treespec_pprint
  9. __all__ = ["tree_map_", "treespec_pprint"]
  10. with warnings.catch_warnings():
  11. warnings.simplefilter("always")
  12. warnings.warn(
  13. "`torch._functorch.pytree_hacks` is deprecated and will be removed in a future release. "
  14. "Please `use torch.utils._pytree` instead.",
  15. DeprecationWarning,
  16. stacklevel=2,
  17. )