
    sgd                         U d dl mZmZmZ d dlmZ  G d d      Zi aeej                  ef   e	d<   dej                  deddfd	Z
dej                  dee   fd
Zy)    )castDictOptionalNc                       e Zd Zy)_StateN)__name__
__module____qualname__     V/var/www/html/venv/lib/python3.12/site-packages/torch/distributed/_composable_state.pyr   r      s    r   r   _module_state_mappingmodulestatereturnc                 <    | t         vsJ d|  d       |t         | <   y )Nz
Inserting z more than once.)r   )r   r   s     r   _insert_module_stater      s+    ..U*VHDT0UU.$)&!r   c                 f    t        | t              rt        t        |       S | t        v r	t        |    S y)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.
    N)
isinstancer   r   r   )r   s    r   _get_module_stater      s4     &&!FF## **(00r   )typingr   r   r   torch.nnnnr   r   Module__annotations__r   r   r   r   r   <module>r      sm    ' ' 	 	 24 tBIIv-. 3* *6 *d *bii HV,< r   