
    ΅i`
                        S SK Jr  S SKJr  S SKr\\\4   rS
S jr " S S\R                  R                  5      r " S S5      r/ S	Qrg)    )annotations)SelfNc                 >    [         R                  R                  5       $ )zD
Return an opaque token representing the id of a graph memory pool.
)torch_C_mtia_graphPoolHandle     O/home/james-whalen/.local/lib/python3.13/site-packages/torch/mtia/mtia_graph.pygraph_pool_handler      s    
 88))++r
   c                     ^  \ rS rSrSrSSU 4S jjjrSU 4S jjrSU 4S jjrSU 4S jjrSU 4S jjr	SU 4S jjr
SU 4S	 jjrS
rU =r$ )	MTIAGraph   z
Wrapper around a MTIA graph.
c                "   > [         TU ]  X5      $ N)super__new__)cls
keep_graph	__class__s     r   r   MTIAGraph.__new__   s    ws//r
   c                $   > [         TU ]  U5        g)z
Begin capturing a MTIA graph.
N)r   capture_begin)selfpoolr   s     r   r   MTIAGraph.capture_begin   s     	d#r
   c                "   > [         TU ]  5         g)z"
End the capture of a MTIA graph.
N)r   capture_endr   r   s    r   r   MTIAGraph.capture_end"        	r
   c                "   > [         TU ]  5         g)z&
Instantiate the captured MTIA graph.
N)r   instantiater   s    r   r#   MTIAGraph.instantiate(   r!   r
   c                "   > [         TU ]  5         g)z!
Replay the captured MTIA graph.
N)r   replayr   s    r   r&   MTIAGraph.replay.   s     	r
   c                "   > [         TU ]  5         g)z2
Destroy the captured graph and reset the states.
N)r   resetr   s    r   r)   MTIAGraph.reset4   s     	r
   c                    > [         TU ]  5       $ )zH
Return an opaque token representing the id of this graph's memory pool
)r   r   r   s    r   r   MTIAGraph.pool:   s     w|~r
   r	   )F)r   boolreturnr   )r   _POOL_HANDLEr.   Noner.   r0   r.   r/   )__name__
__module____qualname____firstlineno____doc__r   r   r   r#   r&   r)   r   __static_attributes____classcell__)r   s   @r   r   r      s5    0 0$ r
   r   c                  T    \ rS rSr% SrS\S'     S	     S
S jjrSS jrSS jrSr	g)graphA   Ntorch.mtia.Stream | Nonedefault_capture_streamc                ~   U R                   R                  c-  [        R                  R	                  5       U R                   l        Uc  SOU4U l        Ub  UOU R                   R                  U l        U R                  c  [        S5      e[        R                  R                  U R                  5      U l	        Xl
        g )Nr	   zcapture_stream must not be None)r   r>   r   mtiacurrent_streamr   capture_streamAssertionErrorstream
stream_ctx
mtia_graph)r   rF   r   rD   s       r   __init__graph.__init__D   s     >>00849JJ4M4M4ODNN1;?<RdW	(Fdnn.S.S 	 & !BCC**++D,?,?@$r
   c                *   [         R                  R                  5         [         R                  R                  5         U R                  R                  5         U R                  (       a  U R                  S   OSnU R                  R                  U5        g )Nr   )r   r   )	r   r@   synchronizeempty_cacherE   	__enter__r   rF   r   )r   pool_args     r   rL   graph.__enter__V   sY    

 

 !!##'99499Q<&%%h/r
   c                j    U R                   R                  5         U R                  R                  " U6   g r   )rF   r   rE   __exit__)r   argss     r   rP   graph.__exit___   s$    ##%  $'r
   )rB   rF   r   rE   )NN)rF   r   r   z_POOL_HANDLE | NonerD   r=   r1   )rQ   objectr.   r0   )
r3   r4   r5   r6   r>   __annotations__rG   rL   rP   r8   r	   r
   r   r;   r;   A   sA    7;4;
 %)+/	%% "% )	%$0(r
   r;   )r   r;   r   r2   )
__future__r   typing_extensionsr   r   tupleintr/   r   r   
_MTIAGraphr   r;   __all__r	   r
   r   <module>r[      sK    " "  S#X,*## *Z (  (Fr
   