
    3KiC
                        S SK Jr  S SKJr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)OptionalUnion)SelfNc                 >    [         R                  R                  5       $ )zD
Return an opaque token representing the id of a graph memory pool.
)torch_C_mtia_graphPoolHandle     W/var/www/html/dynamic-report/venv/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_HANDLEr0   Noner0   r2   r0   r1   )__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Optional[torch.mtia.Stream]default_capture_streamc                l   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   e[        R                  R                  U R                  5      U l        Xl	        g )Nr   )
r   r@   r   mtiacurrent_streamr   capture_streamstream
stream_ctx
mtia_graph)r   rG   r   rE   s       r   __init__graph.__init__D   s     >>00849JJ4M4M4ODNN1 ,BTG 		 (Fdnn.S.S 	 ""...**++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   rB   synchronizeempty_cacherF   	__enter__r   rG   r   )r   pool_args     r   rM   graph.__enter__W   sY    

 

 !!##'99499Q<&%%h/r   c                j    U R                   R                  5         U R                  R                  " U6   g r   )rG   r    rF   __exit__)r   argss     r   rQ   graph.__exit__`   s$    ##%  $'r   )rD   rG   r   rF   )NN)rG   r   r   zOptional[_POOL_HANDLE]rE   r?   r3   )rR   objectr0   r2   )
r5   r6   r7   r8   r@   __annotations__rH   rM   rQ   r:   r   r   r   r=   r=   A   sA    :>7>
 (,.2	%% %% ,	%&0(r   r=   )r   r=   r   r4   )
__future__r   typingr   r   typing_extensionsr   r   tupleintr1   r   r	   
_MTIAGraphr   r=   __all__r   r   r   <module>r]      sN    " " "  S#X,*## *Z!( !(Hr   