_deprecated.py 819 Bytes
Newer Older
1
import warnings
2
from typing import Any, List, Union
3

4
import torch
5

6
from torchvision import datapoints
7
8
9
from torchvision.transforms import functional as _F


10
@torch.jit.unused
11
12
13
14
15
16
def to_tensor(inpt: Any) -> torch.Tensor:
    warnings.warn(
        "The function `to_tensor(...)` is deprecated and will be removed in a future release. "
        "Instead, please use `to_image_tensor(...)` followed by `convert_image_dtype(...)`."
    )
    return _F.to_tensor(inpt)
17
18


Philip Meier's avatar
Philip Meier committed
19
def get_image_size(inpt: Union[datapoints._ImageTypeJIT, datapoints._VideoTypeJIT]) -> List[int]:
20
21
22
23
24
    warnings.warn(
        "The function `get_image_size(...)` is deprecated and will be removed in a future release. "
        "Instead, please use `get_spatial_size(...)` which returns `[h, w]` instead of `[w, h]`."
    )
    return _F.get_image_size(inpt)