_deprecated.py 1.16 KB
Newer Older
1
import warnings
2
from typing import Any, List, Union
3
4

import PIL.Image
5
import torch
6

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


11
@torch.jit.unused
12
13
def to_grayscale(inpt: PIL.Image.Image, num_output_channels: int = 1) -> PIL.Image.Image:
    warnings.warn(
14
15
        "The function `to_grayscale` is deprecated in will be removed in a future release. "
        "Instead, please use `rgb_to_grayscale`.",
16
17
18
19
    )
    return _F.to_grayscale(inpt, num_output_channels=num_output_channels)


20
@torch.jit.unused
21
22
23
24
25
26
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)
27
28


Philip Meier's avatar
Philip Meier committed
29
def get_image_size(inpt: Union[datapoints._ImageTypeJIT, datapoints._VideoTypeJIT]) -> List[int]:
30
31
32
33
34
    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)