_deprecated.py 808 B

123456789101112131415161718192021222324
  1. import warnings
  2. from typing import Any, List
  3. import torch
  4. from torchvision.transforms import functional as _F
  5. @torch.jit.unused
  6. def to_tensor(inpt: Any) -> torch.Tensor:
  7. """[BETA] [DEPREACTED] Use to_image() and to_dtype() instead."""
  8. warnings.warn(
  9. "The function `to_tensor(...)` is deprecated and will be removed in a future release. "
  10. "Instead, please use `to_image(...)` followed by `to_dtype(..., dtype=torch.float32, scale=True)`."
  11. )
  12. return _F.to_tensor(inpt)
  13. def get_image_size(inpt: torch.Tensor) -> List[int]:
  14. warnings.warn(
  15. "The function `get_image_size(...)` is deprecated and will be removed in a future release. "
  16. "Instead, please use `get_size(...)` which returns `[h, w]` instead of `[w, h]`."
  17. )
  18. return _F.get_image_size(inpt)