
    Pg	                         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e
      ZdD ]  Z eeeefd         ee      Zy)	    )AnyIterable)InvalidVersionVersion)__version__TorchVersionc                   @     e Zd ZdZdedefdZdededef fdZ x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                     t        |t              r|S t        |t              rt        |      S t        |t              r!t        dj	                  d |D                    S t        |      )N.c              3   2   K   | ]  }t        |        y wN)str).0items     Z/var/www/html/suriana-translation/venv/lib/python3.12/site-packages/torch/torch_version.py	<genexpr>z3TorchVersion._convert_to_version.<locals>.<genexpr>)   s     #>$CI#>s   )
isinstancer   r   r   joinr   )selfr
   s     r   _convert_to_versionz TorchVersion._convert_to_version   sV    c7#JS!3<X& 388#>##>>?? %%    cmpmethodc                     	  t        t        |       |      | j                  |            S # t        $ r5}t	        |t
              s  t        t               |      |      cY d }~S d }~ww xY wr   )getattrr   r   BaseExceptionr   r   super)r   r   r   e	__class__s       r   _cmp_wrapperzTorchVersion._cmp_wrapper-   s`    	11774=&1$2J2J32OPP 	1a0 ,757F+C00	1s   )- 	A+*A& A+&A+)
__name__
__module____qualname____doc__r   r   r   boolr"   __classcell__)r!   s   @r   r   r   
   s:    $&s &s & 1 1S 1T 1 1r   )__gt____lt____eq____ge____le__c                 &    | j                  ||      S r   )r"   )xyr   s      r   <lambda>r1   <   s    q&(A r   N)typingr   r   torch._vendor.packaging.versionr   r   torch.versionr   internal_version__all__r   r   
cmp_methodsetattr r   r   <module>r:      sX      C 9 
+13 +1\ E J&A +,r   