o
    ei{                     @   s   U d dl Z d dlmZ d dlmZ G dd dZe  ae jeje j	e f e
d< dejdeddfd	d
ZdejdedB fddZdS )    N)castc                   @   s   e Zd ZdS )_StateN)__name__
__module____qualname__ r   r   m/var/www/addictedbytheproject.nl/epg/venv/lib/python3.10/site-packages/torch/distributed/_composable_state.pyr      s    r   _module_state_mappingmodulestatereturnc                 C   s*   | t v rtd|  dt|t | < d S )Nz
Inserting z more than once.)r	   AssertionErrorweakrefref)r
   r   r   r   r   _insert_module_state   s   r   c                 C   sB   t | tr
tt| S | tv rt|  }| }|du rtd|S dS )at  
    Return the ``_State`` in ``model``.

    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.
    Nz(State has already been garbage collected)
isinstancer   r   r	   r   )r
   	state_refr   r   r   r   _get_module_state   s   

r   )r   typingr   torch.nnnnr   WeakKeyDictionaryr	   ModuleReferenceType__annotations__r   r   r   r   r   r   <module>   s   
 