
    sg+                     d    d dl mZmZmZmZ d dlmZ ddgZe G d de             Z ede      Z	y)    )AnyDictruntime_checkableTypeVar)ProtocolStateful	StatefulTc                   @    e Zd ZdZdeeef   fdZdeeef   ddfdZy)r   zN
    Stateful protocol for objects that can be checkpointed and restored.
    returnc                      y)a  
        Objects should return their state_dict representation as a dictionary.
        The output of this function will be checkpointed, and later restored in
        `load_state_dict()`.

        .. warning::
            Because of the inplace nature of restoring a checkpoint, this function
            is also called during `torch.distributed.checkpoint.load`.


        Returns:
            Dict: The objects state dict
        N )selfs    X/var/www/html/venv/lib/python3.12/site-packages/torch/distributed/checkpoint/stateful.py
state_dictzStateful.state_dict   s     	    r   Nc                      y)z
        Restore the object's state from the provided state_dict.

        Args:
            state_dict: The state dict to restore from
        Nr   )r   r   s     r   load_state_dictzStateful.load_state_dict   s     	r   )	__name__
__module____qualname____doc__r   strr   r   r   r   r   r   r   r      s6    DcN "$sCx. T r   )boundN)
typingr   r   r   r   typing_extensionsr   __all__r   r	   r   r   r   <module>r      sD    8 8 & {
# x  B Kx0	r   