3
Á3W^ú  ã               @   s¢   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ ydd	lm	Z	 W n e
k
rt   Y nX d
adadd„ Zdd„ Zdd„ Zdd„ ZdS )é    N)Úmodels)Údatasets)Úops)Ú
transforms)Úutils)Úioé   )Ú__version__ÚPILÚpyavc             C   s   | dkrt dj| ƒƒ‚| 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
   Úaccimagez6Invalid backend '{}'. Options are 'PIL' and 'accimage'N)r
   r   )Ú
ValueErrorÚformatÚ_image_backend)Úbackend© r   ú;/tmp/pip-build-7wfi2gtz/torchvision/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   s8   | dkrt d|  ƒ‚| dkr0tj r0tjdƒ 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 is generally decoding faster than pyav, but perhaps is less robust.
    r   Úvideo_readerzAInvalid video backend '%s'. Options are 'pyav' and 'video_reader'z+video_reader video backend is not availableN)r   r   )r   r   Z_HAS_VIDEO_OPTÚwarningsÚwarnÚ_video_backend)r   r   r   r   Úset_video_backend+   s    
r   c               C   s   t S )N)r   r   r   r   r   Úget_video_backendB   s    r   )r   Ztorchvisionr   r   r   r   r   r   Úversionr	   ÚImportErrorr   r   r   r   r   r   r   r   r   r   Ú<module>   s    