a
    dg                     @   s  d dl Z d dlZd dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZ ddlmZ zddlmZ W n eyr   Y n0 ese je jee je je  dkrdZeee   d	ad
add Zdd Zdd Zdd Zdd Z da!dZ"dd Z#dS )    N)Module)datasetsiomodelsops
transformsutils   )_HAS_OPS)__version__torchvisionzYou are importing torchvision within its own root folder ({}). This is not expected to work and may give errors. Please exit the torchvision project source and relaunch your python interpreter.PILpyavc                 C   s    | dvrt d|  d| adS )a*  
    Specifies the package used to load images.

    Args:
        backend (string): Name of the image backend. one of {'PIL', 'accimage'}.
            The :mod:`accimage` package uses the Intel IPP library. It is
            generally faster than PIL, but does not support as many operations.
    )r   ZaccimagezInvalid backend 'z#'. Options are 'PIL' and 'accimage'N)
ValueError_image_backend)backend r   ]/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/torchvision/__init__.pyset_image_backend    s    
r   c                   C   s   t S )z:
    Gets the name of the package used to load images
    )r   r   r   r   r   get_image_backend/   s    r   c                 C   sT   | dvrt d|  | dkr0tjs0d}t|n | dkrLtjsLd}t|n| adS )a  
    Specifies the package used to decode videos.

    Args:
        backend (string): Name of the video backend. one of {'pyav', 'video_reader'}.
            The :mod:`pyav` package uses the 3rd party PyAv library. It is a Pythonic
            binding for the FFmpeg libraries.
            The :mod:`video_reader` package includes a native C++ implementation on
            top of FFMPEG libraries, and a python API of TorchScript custom operator.
            It generally decodes faster than :mod:`pyav`, but is perhaps less robust.

    .. note::
        Building with FFMPEG is disabled by default in the latest `main`. If you want to use the 'video_reader'
        backend, please compile torchvision from source.
    )r   video_readercudazIInvalid video backend '%s'. Options are 'pyav', 'video_reader' and 'cuda'r   zavideo_reader video backend is not available. Please compile torchvision from source and try againr   z$cuda video backend is not available.N)r   r   Z_HAS_VIDEO_OPTRuntimeErrorZ_HAS_GPU_VIDEO_DECODER_video_backend)r   messager   r   r   set_video_backend6   s    

r   c                   C   s   t S )z
    Returns the currently active video backend used to decode videos.

    Returns:
        str: Name of the video backend. one of {'pyav', 'video_reader'}.
    )r   r   r   r   r   get_video_backendU   s    r   c                   C   s
   t j S )N)torchZ_CZ_get_tracing_stater   r   r   r   _is_tracing`   s    r   Ta
  The torchvision.datapoints and torchvision.transforms.v2 namespaces are still Beta. While we do not expect major breaking changes, some APIs may still change according to user feedback. Please submit any feedback you may have in this issue: https://github.com/pytorch/vision/issues/6753, and you can also check out https://github.com/pytorch/vision/issues/7319 to learn more about the APIs that we suspect might involve future changes. You can silence this warning by calling torchvision.disable_beta_transforms_warning().c                   C   s   da d S )NF)_WARN_ABOUT_BETA_TRANSFORMSr   r   r   r   disable_beta_transforms_warningp   s    r    )$oswarningsZmodulefinderr   r   r   r   r   r   r   r   r   	extensionr
   versionr   ImportErrorpathdirnamerealpath__file__joingetcwdr   warnformatr   r   r   r   r   r   r   r   Z_BETA_TRANSFORMS_WARNINGr    r   r   r   r   <module>   s4    