o
    "i	                     @   sl   d dl mZmZ ddlmZmZ ddlmZ dgZ	G dd de
ZdD ]Zeeeefdd	 q#eeZd
S )    )AnyIterable   )InvalidVersionVersion)__version__TorchVersionc                       s@   e Zd ZdZdedefddZdededef fdd	Z  Z	S )
r   ab  A string with magic powers to compare to both Version and iterables!
    Prior to 1.10.0 torch.__version__ was stored as a str and so many did
    comparisons against torch.__version__ as if it were a str. In order to not
    break them we have TorchVersion which masquerades as a str while also
    having the ability to compare against both packaging.version.Version as
    well as tuples of values, eg. (1, 2, 1)
    Examples:
        Comparing a TorchVersion object to a Version object
            TorchVersion('1.10.0a') > Version('1.10.0a')
        Comparing a TorchVersion object to a Tuple object
            TorchVersion('1.10.0a') > (1, 2)    # 1.2
            TorchVersion('1.10.0a') > (1, 2, 1) # 1.2.1
        Comparing a TorchVersion object against a string
            TorchVersion('1.10.0a') > '1.2'
            TorchVersion('1.10.0a') > '1.2.1'
    inpreturnc                 C   sJ   t |tr|S t |trt|S t |tr!tddd |D S t|)N.c                 s   s    | ]}t |V  qd S N)str).0item r   Q/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/torch/torch_version.py	<genexpr>*   s    z3TorchVersion._convert_to_version.<locals>.<genexpr>)
isinstancer   r   r   joinr   )selfr	   r   r   r   _convert_to_version   s   


z TorchVersion._convert_to_versioncmpmethodc              
      s\   zt t| || |W S  ty- } zt|ts t t ||W  Y d }~S d }~ww r   )getattrr   r   BaseExceptionr   r   super)r   r   r   e	__class__r   r   _cmp_wrapper.   s   
zTorchVersion._cmp_wrapper)
__name__
__module____qualname____doc__r   r   r   boolr   __classcell__r   r   r   r   r      s    ")__gt____lt____eq____ge____le__c                 C   s   |  ||S r   )r   )xyr   r   r   r   <lambda>=   s    r-   N)typingr   r   _vendor.packaging.versionr   r   versionr   internal_version__all__r   r   
cmp_methodsetattrr   r   r   r   <module>   s   .
