U
    Å9%e<  ã                   @   st   U d dl mZmZmZ d dlmZ G dd„ dƒZi aeejef e	d< ejeddœdd„Z
ejee d	œd
d„ZdS )é    )ÚcastÚDictÚOptionalNc                   @   s   e Zd ZdS )Ú_StateN)Ú__name__Ú
__module__Ú__qualname__© r	   r	   úb/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/torch/distributed/_composable_state.pyr      s   r   Ú_module_state_mapping)ÚmoduleÚstateÚreturnc                 C   s$   | t kstd| › dƒ‚|t | < d S )Nz
Inserting z more than once.)r   ÚAssertionError)r   r   r	   r	   r
   Ú_insert_module_state   s    r   )r   r   c                 C   s,   t | tƒrtt| ƒS | tkr$t|  S dS dS )aK  
    Given a ``module``, this API finds out if the module is also a ``_State``
    instance or if the module is managed by a composable API. If the module
    is also a ``_State``, ``module`` will be casted to ``_State` and returned.
    If it is managed by a composable API, the corresponding ``_State`` will
    be returned.
    N)Ú
isinstancer   r   r   )r   r	   r	   r
   Ú_get_module_state   s
    


r   )Útypingr   r   r   Ztorch.nnÚnnr   r   ÚModuleÚ__annotations__r   r   r	   r	   r	   r
   Ú<module>   s    