Table of Contents
Shortcuts

# Source code for torchvision.transforms.v2.functional._deprecated

    import warnings
    from typing import Any, List

    import torch

    from torchvision.transforms import functional as _F

    @torch.jit.unused
    def to_tensor(inpt: Any) -> torch.Tensor:
        """[BETA] [DEPREACTED] Use to_image() and to_dtype() instead."""
        warnings.warn(
            "The function `to_tensor(...)` is deprecated and will be removed in a future release. "
            "Instead, please use `to_image(...)` followed by `to_dtype(..., dtype=torch.float32, scale=True)`."
        )
        return _F.to_tensor(inpt)

    def get_image_size(inpt: torch.Tensor) -> List[int]:
        warnings.warn(
            "The function `get_image_size(...)` is deprecated and will be removed in a future release. "
            "Instead, please use `get_size(...)` which returns `[h, w]` instead of `[w, h]`."
        )
        return _F.get_image_size(inpt)

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.