ó
    0Vðijp  ã                  óØ  • % S SK Jr  S SKrS SKrS SKJr  S SKJrJrJrJ	r	J
r
  S SKJrJrJr  S SKrS SKJr  \(       a  S SKJr  SS	KJr  / S
Qr\" S5      r\" S5      r\" \R2                  S5      (       d]  \" S5      \R2                  R4                  S'   \" S5      \R2                  R4                  S'   \" S5      \R2                  R4                  S'   S SKJrJrJr  SS jrS S jr  " S S\R2                  R:                  5      r! " S S5      r"\
S\S\#4   4   r$S\%S'   \   S!           S"S jj5       r&\   S!           S#S jj5       r&   S!           S$S jjr&g)%é    )ÚannotationsN)ÚCallable)ÚOptionalÚoverloadÚTYPE_CHECKINGÚ	TypeAliasÚUnion)Ú	ParamSpecÚSelfÚTypeVar)ÚTensor)Ú_POOL_HANDLEé   )Ú_dummy_type)Úis_current_stream_capturingÚgraph_pool_handleÚ	CUDAGraphÚgraphÚmake_graphed_callablesÚ_RÚ_PÚ_CudaStreamBaseÚ
_CUDAGraphÚ_graph_pool_handleÚ_cuda_isCurrentStreamCapturing)r   r   r   c                 ó   • [        5       $ )zÄReturn True if CUDA graph capture is underway on the current CUDA stream, False otherwise.

If a CUDA context does not exist on the current device, returns False without initializing the context.
)r   © ó    ÚVD:\a\ltx-desktop-ci\ltx-desktop-ci\python-embed\Lib\site-packages\torch\cuda\graphs.pyr   r   1   s   € ô
 *Ó+Ð+r   c                 óP   • [         R                  R                  [        5       5      $ )zÊReturn an opaque token representing the id of a graph memory pool.

See :ref:`Graph memory management<graph-memory-management>`.

.. warning::
    This API is in beta and may change in future releases.
)ÚtorchÚcudar   r   r   r   r   r   r   :   s   € ô �:‰:×"Ñ"Ô#5Ó#7Ó8Ð8r   c                  óä   ^ • \ rS rSrSrSSU 4S jjj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U 4S jjrSU 4S jjrSU 4S jjrSrU =r$ )r   éF   aÙ  Wrapper around a CUDA graph.

Arguments:
    keep_graph (bool, optional): If ``keep_graph=False``, the
        cudaGraphExec_t will be instantiated on GPU at the end of
        ``capture_end`` and the underlying cudaGraph_t will be
        destroyed. Users who want to query or otherwise modify the
        underlying cudaGraph_t before instantiation can set
        ``keep_graph=True`` and access it via ``raw_cuda_graph`` after
        ``capture_end``. Note that the cudaGraphExec_t will not be
        instantiated at the end of ``capture_end`` in this
        case. Instead, it will be instantiated via an explicit called
        to ``instantiate`` or automatically on the first call to
        ``replay`` if ``instantiate`` was not already called. Calling
        ``instantiate`` manually before ``replay`` is recommended to
        prevent increased latency on the first call to ``replay``. It
        is allowed to modify the raw cudaGraph_t after first calling
        ``instantiate``, but the user must call ``instantiate`` again
        manually to make sure the instantiated graph has these
        changes. Pytorch has no means of tracking these changes.

.. warning::
    This API is in beta and may change in future releases.

c                ó"   >• [         TU ]  X5      $ ©N)ÚsuperÚ__new__)ÚclsÚ
keep_graphÚ	__class__s     €r   r(   ÚCUDAGraph.__new__a   s   ø€ Ü‰w‰˜sÓ/Ð/r   c                ó    >• [         TU ]  XS9  g)aˆ  Begin capturing CUDA work on the current stream.

Typically, you shouldn't call ``capture_begin`` yourself.
Use :class:`~torch.cuda.graph` or :func:`~torch.cuda.make_graphed_callables`,
which call ``capture_begin`` internally.

Arguments:
    pool (optional): Token (returned by :func:`~torch.cuda.graph_pool_handle` or
        :meth:`other_Graph_instance.pool()<torch.cuda.CUDAGraph.pool>`) that hints this graph may share memory
        with the indicated pool.  See :ref:`Graph memory management<graph-memory-management>`.
    capture_error_mode (str, optional): specifies the cudaStreamCaptureMode for the graph capture stream.
        Can be "global", "thread_local" or "relaxed". During cuda graph capture, some actions, such as cudaMalloc,
        may be unsafe. "global" will error on actions in other threads, "thread_local" will only error for
        actions in the current thread, and "relaxed" will not error on these actions. Do NOT change this setting
        unless you're familiar with `cudaStreamCaptureMode <https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g9d0535d93a214cbf126835257b16ba85>`_
)ÚpoolÚcapture_error_modeN)r'   Úcapture_begin)Úselfr.   r/   r+   s      €r   r0   ÚCUDAGraph.capture_begind   s   ø€ ô& 	‰Ñ 4ÐÒOr   c                ó"   >• [         TU ]  5         g)a  End CUDA graph capture on the current stream.

After ``capture_end``, ``replay`` may be called on this instance.

Typically, you shouldn't call ``capture_end`` yourself.
Use :class:`~torch.cuda.graph` or :func:`~torch.cuda.make_graphed_callables`,
which call ``capture_end`` internally.
N)r'   Úcapture_end©r1   r+   s    €r   r4   ÚCUDAGraph.capture_endy   s   ø€ ô 	‰ÑÕr   c                ó"   >• [         TU ]  5         g)züInstantiate the CUDA graph. Will be called by
``capture_end`` if ``keep_graph=False``, or by ``replay`` if
``keep_graph=True`` and ``instantiate`` has not already been
explicitly called. Does not destroy the cudaGraph_t returned
by ``raw_cuda_graph``.
N)r'   Úinstantiater5   s    €r   r8   ÚCUDAGraph.instantiate„   s   ø€ ô 	‰ÑÕr   c                ó"   >• [         TU ]  5         g)z,Replay the CUDA work captured by this graph.N)r'   Úreplayr5   s    €r   r;   ÚCUDAGraph.replay�   s   ø€ ä‰‰Õr   c                ó"   >• [         TU ]  5         g)z1Delete the graph currently held by this instance.N)r'   Úresetr5   s    €r   r>   ÚCUDAGraph.reset‘   s   ø€ ä‰‰�r   c                ó    >• [         TU ]  5       $ )zÌReturn an opaque token representing the id of this graph's memory pool.

This id can optionally be passed to another graph's ``capture_begin``,
which hints the other graph may share the same memory pool.
)r'   r.   r5   s    €r   r.   ÚCUDAGraph.pool•   s   ø€ ô ‰w‰|‹~Ðr   c                ó    >• [         TU ]  5       $ )z/Enable debugging mode for CUDAGraph.debug_dump.)r'   Úenable_debug_moder5   s    €r   rC   ÚCUDAGraph.enable_debug_mode�   s   ø€ ä‰wÑ(Ó*Ð*r   c                ó"   >• [         TU ]  U5      $ )z®
Arguments:
    debug_path (required): Path to dump the graph to.

Calls a debugging function to dump the graph if the debugging is
enabled via CUDAGraph.enable_debug_mode()
)r'   Ú
debug_dump)r1   Ú
debug_pathr+   s     €r   rF   ÚCUDAGraph.debug_dump¡   s   ø€ ô ‰wÑ! *Ó-Ð-r   c                ó    >• [         TU ]  5       $ )am  Returns the underlying cudaGraph_t. ``keep_graph`` must be True.

See the following for APIs for how to manipulate this object: `Graph Managmement <https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH.html>`_ and `cuda-python Graph Management bindings <https://nvidia.github.io/cuda-python/cuda-bindings/latest/module/runtime.html#graph-management>`_
)r'   Úraw_cuda_graphr5   s    €r   rJ   ÚCUDAGraph.raw_cuda_graph«   s   ø€ ô
 ‰wÑ%Ó'Ð'r   c                ó    >• [         TU ]  5       $ )aš  Returns the underlying cudaGraphExec_t. ``instantiate`` must have been called if ``keep_graph`` is True, or ``capture_end`` must have been called if ``keep_graph`` is False. If you call ``instantiate()`` after ``raw_cuda_graph_exec()``, the previously returned cudaGraphExec_t will be destroyed. It is your responsibility not to use this object after destruction.

See the following for APIs for how to manipulate this object: `Graph Execution <https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__GRAPH__EXEC.html>`_ and `cuda-python Graph Execution bindings <https://nvidia.github.io/cuda-python/cuda-bindings/latest/module/runtime.html#graph-execution>`_
)r'   Úraw_cuda_graph_execr5   s    €r   rM   ÚCUDAGraph.raw_cuda_graph_exec²   s   ø€ ô
 ‰wÑ*Ó,Ð,r   r   )F)r*   ÚboolÚreturnr   )NÚglobal)r.   úOptional[_POOL_HANDLE]r/   ÚstrrP   ÚNone©rP   rT   ©rP   r   )rG   rS   rP   rT   )rP   Úint)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r(   r0   r4   r8   r;   r>   r.   rC   rF   rJ   rM   Ú__static_attributes__Ú__classcell__)r+   s   @r   r   r   F   sr   ø† ñ÷40ñ 0ð NVðPØ*ðPØGJðPà	÷Pð P÷*	÷÷÷÷÷+÷.÷(÷-õ -r   r   c                  ó^   • \ rS 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)r   éº   am  Context-manager that captures CUDA work into a :class:`torch.cuda.CUDAGraph` object for later replay.

See :ref:`CUDA Graphs <cuda-graph-semantics>` for a general introduction,
detailed use, and constraints.

Arguments:
    cuda_graph (torch.cuda.CUDAGraph): Graph object used for capture.
    pool (optional): Opaque token (returned by a call to :func:`~torch.cuda.graph_pool_handle()` or
        :meth:`other_Graph_instance.pool()<torch.cuda.CUDAGraph.pool>`) hinting this graph's capture
        may share memory from the specified pool. See :ref:`Graph memory management<graph-memory-management>`.
    stream (torch.cuda.Stream, optional): If supplied, will be set as the current stream in the context.
        If not supplied, ``graph`` sets its own internal side stream as the current stream in the context.
    capture_error_mode (str, optional): specifies the cudaStreamCaptureMode for the graph capture stream.
        Can be "global", "thread_local" or "relaxed". During cuda graph capture, some actions, such as cudaMalloc,
        may be unsafe. "global" will error on actions in other threads, "thread_local" will only error for
        actions in the current thread, and "relaxed" will not error on actions. Do NOT change this setting
        unless you're familiar with `cudaStreamCaptureMode <https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g9d0535d93a214cbf126835257b16ba85>`_

.. note::
    For effective memory sharing, if you pass a ``pool`` used by a previous capture and the previous capture
    used an explicit ``stream`` argument, you should pass the same ``stream`` argument to this capture.

.. warning::
    This API is in beta and may change in future releases.

.. _cudaStreamCaptureMode:
    https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g9d0535d93a214cbf126835257b16ba85
NúOptional[torch.cuda.Stream]Údefault_capture_streamc                óx  • 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	        X@l
        g )Nr   )r+   rb   r!   r"   ÚStreamr.   Úcapture_streamÚstreamÚ
stream_ctxÚ
cuda_graphr/   )r1   rh   r.   rf   r/   s        r   Ú__init__Úgraph.__init__Ú   sš   € ð �>‰>×0Ñ0Ñ8Ü49·J±J×4EÑ4EÓ4GˆD�N‰NÔ1ð ‘,‰B T Gð 	Œ	ð Ñ(‰F¨d¯n©n×.SÑ.Sð 	Ôð ×"Ñ"Ñ.Ð.Ð.ÜŸ*™*×+Ñ+¨D×,?Ñ,?Ó@ˆŒØ$ŒØ"4Õr   c                óŒ  • [         R                  R                  5         [         R                  R                  R
                  (       a  [        R                  " 5         [         R                  R                  5         U R                  R                  5         U R                  R                  " U R                  SU R                  06  g )Nr/   )r!   r"   ÚsynchronizeÚcompilerÚconfigÚforce_cudagraph_gcÚgcÚcollectÚempty_cacherg   Ú	__enter__rh   r0   r.   r/   )r1   s    r   rs   Úgraph.__enter__ò   s{   € ä�
‰
×ÑÔ ä�>‰>× Ñ ×3×3ô �JŠJŒLä�
‰
×ÑÔ ð 	�‰×!Ñ!Ô#à�‰×%Ò%à�Y‰Yð	
ð  $×6Ñ6ó		
r   c                ój   • U R                   R                  5         U R                  R                  " U6   g r&   )rh   r4   rg   Ú__exit__)r1   Úargss     r   rv   Úgraph.__exit__  s$   € Ø�‰×#Ñ#Ô%Ø�‰× Ò  $Ò'r   )r/   re   rh   r.   rg   )NNrQ   )rh   r   r.   rR   rf   ra   r/   rS   rU   )rw   ÚobjectrP   rT   )rX   rY   rZ   r[   r\   rb   Ú__annotations__ri   rs   rv   r]   r   r   r   r   r   º   sU   ‡ ñð: ;?ÐÐ7Ó>ð
 (,Ø.2Ø"*ð5àð5ð %ð5ð ,ð	5ð
  õ5ô0
÷2(r   r   útorch.nn.Module.r   Ú_ModuleOrCallablec                ó   • g r&   r   ©Ú	callablesÚsample_argsÚnum_warmup_itersÚallow_unused_inputr.   s        r   r   r     s   € ð r   c                ó   • g r&   r   r~   s        r   r   r     s   € ð %(r   c                ó  • [         R                  " 5       (       a%  [         R                  " 5       (       a  [        S5      eSn[	        U [
        5      (       d+  SnU 4n [        R                  " [
        [        S4   U5      4nO-[        R                  " [
        [
        [        S4   S4   U5      n/ n[        X5       GH  u  p‰[	        U[         R                  R                  5      (       a~  [        UR                  5      S:X  a2  [        UR                  5      S:X  a  [        UR                  5      S:X  d   S5       e[!        S UR#                  5        5       5      (       d   S5       e[         R$                  R&                  R(                  " U	6 n
UR+                  [        U
5      5        [!        S	 U
 5       5      (       a  GM   S
5       e   U V	s/ s H  n	[        U	5      PM     nn	U  Vs/ s HG  n[	        U[         R                  R                  5      (       a  [        UR-                  5       5      OSPMI     nn[/        [        U 5      5       Vs/ s H  nX}   XÍ   -   PM     nn[/        [        U 5      5       Vs/ s H!  n[         R0                  R3                  5       PM#     nn[/        [        U 5      5       Vs/ s H!  n[         R0                  R3                  5       PM#     nnUc
  [5        5       OUn[         R0                  R7                  5         [         R0                  R9                  [         R0                  R;                  5       5         [        XU5       H¼  u  nn	nSu  nnn[/        U5       H“  n[         R$                  R&                  R=                  U" U	6 5      n[        S U 5       5      n[        U5      S:”  d  MR  [         R>                  RA                  U[        S U 5       5      [        S U 5       5      SUS9nM•     UUU4 H  nAM     M¾     SSS5        [         R0                  R7                  5         / n/ n[        XU5       HŠ  u  nn	n[         R0                  RC                  UUS9   U" U	6 nSSS5        [         R$                  R&                  RE                  W5      u  nnUR+                  [        U5      5        UR+                  U5        MŒ     / n/ n [        [G        U5      [G        U5      [G        U5      5       GH  u  nn!n"[        S U! 5       5      n#[        S U! 5       5      nSn[        U5      S:”  ah  [         R0                  RC                  U"US9   [         R>                  RA                  U[        S U 5       5      [        S U# 5       5      SUS9nSSS5        / n$Sn%U HC  n&U&RH                  (       a  Ub  U$R+                  UU%   5        U%S-  n%M2  U$R+                  S5        ME     [        U$5      n$UR+                  U#5        U R+                  U$5        GM"     URK                  5         U RK                  5                             SS jn'/ n([M        U 5       H®  u  nnU'" UU   UU   XÍ   X½   UU   Xí   UU   UU   U U   5	      n)[	        U[         R                  R                  5      (       aF            SS jn*U*" UURN                  U)URP                  5      Ul(        U(R+                  U5        M�  U(R+                  U)5        M°     U(       a  U(S   $ [        U(5      $ s  sn	f s  snf s  snf s  snf s  snf ! , (       d  f       GNC= f! , (       d  f       GNô= f! , (       d  f       GNÚ= f)a  Accept callables (functions or :class:`nn.Module<torch.nn.Module>`\ s) and returns graphed versions.

Each graphed callable's forward pass runs its source callable's
forward CUDA work as a CUDA graph inside a single autograd node.

The graphed callable's forward pass also appends
a backward node to the autograd graph. During backward, this node runs the
callable's backward work as a CUDA graph.

Therefore, each graphed callable should be a drop-in replacement for its source callable
in an autograd-enabled training loop.

See :ref:`Partial-network capture<partial-network-capture>` for detailed use and constraints.

If you pass a tuple of several callables, their captures will use the same memory pool.
See :ref:`Graph memory management<graph-memory-management>` for when this is appropriate.

Arguments:
    callables (torch.nn.Module or Python function, or tuple of these): Callable or callables to graph.
        See :ref:`Graph memory management<graph-memory-management>` for when passing a tuple of callables
        is appropriate.  If you pass a tuple of callables, their order in the tuple must be the same order
        they'll run in the live workload.
    sample_args (tuple of Tensors, or tuple of tuples of Tensors): Samples args for each callable.
        If a single callable was passed, ``sample_args`` must be a single tuple of argument Tensors.
        If a tuple of callables was passed, ``sample_args`` must be tuple of tuples of argument Tensors.
    num_warmup_iters (int): The number of warmup iterations. Currently, ``DataDistributedParallel`` needs
        11 iterations for warm up. Default: ``3``.
    allow_unused_input (bool): If False, specifying inputs that were not used when computing outputs
        (and therefore their grad is always zero) is an error. Defaults to False.
    pool (optional): Token (returned by :func:`~torch.cuda.graph_pool_handle` or
        :meth:`other_Graph_instance.pool()<torch.cuda.CUDAGraph.pool>`) that hints this graph may share memory
        with the indicated pool.  See :ref:`Graph memory management<graph-memory-management>`.
.. note::
    The ``requires_grad`` state of each Tensor in ``sample_args`` must match the state
    that's expected for the corresponding real input in the training loop.

.. warning::
    This API is in beta and may change in future releases.

.. warning::
    ``sample_args`` for each callable must contain only Tensors. Other types are not allowed.

.. warning::
    Returned callables do not support higher order differentiation (e.g., double backward).

.. warning::
    In any :class:`~torch.nn.Module` passed to :func:`~make_graphed_callables`, only parameters
    may be trainable. Buffers must have ``requires_grad=False``.

.. warning::
    After you pass a :class:`torch.nn.Module` through :func:`~make_graphed_callables`,
    you may not add or remove any of that Module's parameters or buffers.

.. warning::
    :class:`torch.nn.Module`\s passed to :func:`~torch.cuda.make_graphed_callables` must not have module hooks
    registered on them at the time they are passed. However, registering hooks on modules *after* passing them
    through :func:`~torch.cuda.make_graphed_callables` is allowed.

.. warning::
    When running a graphed callable, you must pass its arguments in the same order and format
    they appeared in that callable's ``sample_args``.

.. warning::
    The automatic mixed precision is supported in :func:`~torch.cuda.make_graphed_callables` only with disabled
    caching. The context manager `torch.cuda.amp.autocast()` must have `cache_enabled=False`.
z_make_graphed_callables does not support the autocast caching. Please set `cache_enabled=False`.FT.r   z§Modules must not have hooks registered at the time they are passed. However, registering hooks on modules after passing them through make_graphed_callables is allowed.c              3  ó<   #   • U  H  oR                   S L v •  M     g7f)FN©Úrequires_grad©Ú.0Úbs     r   Ú	<genexpr>Ú)make_graphed_callables.<locals>.<genexpr>Œ  s   é € ÐEº°A—‘¨%Õ/ºùs   ‚zœIn any :class:`~torch.nn.Module` passed to :func:`~make_graphed_callables`, only parameters may be trainable. All buffers must have ``requires_grad=False``.c              3  óV   #   • U  H  n[        U[        R                  5      v •  M!     g 7fr&   )Ú
isinstancer!   r   )r‰   Úargs     r   r‹   rŒ   “  s   é € ÐHºK°S”:˜c¤5§<¡<×0Ð0ºKùs   ‚')zfIn the beta API, sample_args for each callable must contain only Tensors. Other types are not allowed.r   N)NNNc              3  óJ   #   • U  H  oR                   (       d  M  Uv •  M     g 7fr&   r†   ©r‰   Úos     r   r‹   rŒ   ´  s   é € Ð$K²¨1¿?½?§Q¡Q²ùó   ‚#š	#c              3  óJ   #   • U  H  oR                   (       d  M  Uv •  M     g 7fr&   r†   ©r‰   Úis     r   r‹   rŒ   ¸  s   é € ð %Ú'; !¿½ŸA™AÒ';ùr“   c              3  ór   #   • U  H-  oR                   (       d  M  [        R                  " U5      v •  M/     g 7fr&   ©r‡   r!   Ú
empty_liker‘   s     r   r‹   rŒ   »  s(   é € ð +Ú9@°AÇOÅOÓ/œE×,Ò,¨Q×/Ð/ºùs   ‚7š7)ÚoutputsÚinputsÚgrad_outputsÚonly_inputsÚallow_unused)r.   c              3  ór   #   • U  H-  oR                   (       a  [        R                  " U5      OS v •  M/     g 7fr&   r˜   r‘   s     r   r‹   rŒ   ß  s'   é € ð $
ÚFTÀ§?§?ŒE×Ò˜QÔ¸Ô<Ânùs   ‚57c              3  óJ   #   • U  H  oR                   (       d  M  Uv •  M     g 7fr&   r†   r‘   s     r   r‹   rŒ   ã  s   é € ÐJª 1¿/½/ŸQ™Qªùr“   c              3  óJ   #   • U  H  oR                   (       d  M  Uv •  M     g 7fr&   r†   r•   s     r   r‹   rŒ   é  s   é € Ð TÒ,@ qÇOÅO§¡Ò,@ùr“   c              3  ó.   #   • U  H  oc  M  Uv •  M     g 7fr&   r   r‘   s     r   r‹   rŒ   ê  s   é € Ð&WÒ2E¨Q§q¡qÒ2Eùs   ‚Œ	é   c	           	     ó†   ^ ^^^^^^^^^
•  " UU UUUUU4S jS[         R                  R                  5      m
SU
UU4S jjn	U	$ )Nc                  óš   >• \ rS rSr\SUUUU4S jj5       r\\R                  R                  R                  SU UU4S jj5       5       r
Srg)ÚOmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphedi  c                ó  >• [        T5       HB  nTU   R                  5       X   R                  5       :w  d  M,  TU   R                  X   5        MD     TR                  5         [	        T[
        5      (       d   e[        S T 5       5      $ )Nc              3  ó@   #   • U  H  oR                  5       v •  M     g 7fr&   ©Údetachr‘   s     r   r‹   Újmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.forward.<locals>.<genexpr>  s   é € Ð@²¨AŸX™XŸZ˜Z²ùs   ‚)ÚrangeÚdata_ptrÚcopy_r;   rŽ   Útuple)Úctxr›   r–   Ú	fwd_graphÚlen_user_argsÚstatic_input_surfaceÚstatic_outputss      €€€€r   ÚforwardÚWmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.forward  s|   ø€ ô ˜}Ö-�AØ+¨AÑ.×7Ñ7Ó9¸V¹Y×=OÑ=OÓ=QÕQØ,¨QÑ/×5Ñ5°f±iÖ@ñ .ð × Ñ Ô"Ü! .´%×8Ñ8Ð8Ð8ÜÑ@±Ó@Ó@Ð@r   c                óH  >• [        U5      [        T5      :X  d   e[        TU5       H?  u  p#Uc  M
  UR                  5       UR                  5       :w  d  M.  UR                  U5        MA     TR	                  5         [        T[        5      (       d   e[        S T 5       5      $ )Nc              3  óL   #   • U  H  nUb  UR                  5       OUv •  M     g 7fr&   r©   rˆ   s     r   r‹   Úkmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.backward.<locals>.<genexpr>*  s(   é € ð ò 0˜ð #$¡-�A—H‘H”J°QÔ6Ú/ùs   ‚"$)ÚlenÚzipr­   r®   r;   rŽ   r¯   )r°   ÚgradsÚgÚgradÚ	bwd_graphÚstatic_grad_inputsÚstatic_grad_outputss       €€€r   ÚbackwardÚXmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.backward  s—   ø€ ô ˜5“z¤SÐ)<Ó%=Ó=Ð=Ð=Ü"Ð#6¸Ö>‘G�AØ“}ð Ÿ:™:›<¨4¯=©=«?Õ:ØŸG™G DžMñ  ?ð × Ñ Ô"ô "Ð"4´e×<Ñ<Ð<Ð<Üñ ñ 0óó ð r   r   N)r°   ry   r›   r   rP   útuple[Tensor, ...])r°   ry   r¼   r   rP   rÄ   )rX   rY   rZ   r[   Ústaticmethodrµ   r!   ÚautogradÚfunctionÚonce_differentiablerÂ   r]   )r¿   r±   r²   rÀ   rÁ   r³   r´   s   €€€€€€€r   ÚGraphedr¦     sN   ø† Ø÷Añ Aó ðAð Ø�^‰^×$Ñ$×8Ñ8÷ð ó 9ó ór   rÉ   c                 óÜ   >• [         R                  R                  R                  " U 6 nTR                  " [        U5      T-   6 n[         R                  R                  R                  UT5      $ r&   )r!   ÚutilsÚ_pytreeÚarg_tree_leavesÚapplyr¯   Útree_unflatten)Ú	user_argsÚflatten_user_argsÚoutrÉ   Úmodule_paramsÚoutput_unflatten_specs      €€€r   ÚfunctionalizedÚVmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.functionalized0  sW   ø€ ô !&§¡× 3Ñ 3× CÒ CÀYÐ OÐØ—-’-¤%Ð(9Ó":¸]Ñ"JÐLˆCÜ—;‘;×&Ñ&×5Ñ5°cÐ;PÓQÐQr   )rÐ   ry   rP   ry   )r!   rÆ   ÚFunction)r±   r¿   rÓ   r²   rÔ   r³   r´   rÁ   rÀ   rÕ   rÉ   s   ````````` @r   Úmake_graphed_autograd_functionÚ>make_graphed_callables.<locals>.make_graphed_autograd_function  s4   ÿù€ ÷	õ 	”e—n‘n×-Ñ-ô 	÷B	Rñ 	Rð Ðr   c                ó$   ^ ^^^• SU UUU4S jjnU$ )Nc                 óD   >• TR                   T:X  a  T" U 0 UD6$ T" U 0 UD6$ r&   )Útraining)rÐ   Úuser_kwargsÚfuncÚgraph_training_stateÚgraphedÚorig_fwds     €€€€r   Únew_fwdÚEmake_graphed_callables.<locals>.make_graphed_forward.<locals>.new_fwdQ  s2   ø€ ð —}‘}Ð(<Ó<Ù&¨	ÐA°[ÑAÐAá'¨ÐB°kÑBÐBr   )rÐ   z_P.argsrÝ   z	_P.kwargsrP   r   r   )rÞ   rß   rà   rá   râ   s   ```` r   Úmake_graphed_forwardÚ4make_graphed_callables.<locals>.make_graphed_forwardK  s   û€ ÷Cò Cð �r   )r±   r   r¿   r   rÓ   ztuple[torch.nn.Parameter, ...]r²   rW   rÔ   ztorch.utils._pytree.TreeSpecr³   rÄ   r´   rÄ   rÁ   ztuple[Optional[Tensor], ...]rÀ   rÄ   rP   zCallable[..., object])
rÞ   r{   rß   rO   rà   úCallable[_P, _R]rá   ræ   rP   ræ   ))r!   Úis_autocast_enabledÚis_autocast_cache_enabledÚRuntimeErrorrŽ   r¯   ÚtypingÚcastr   r»   ÚnnÚModulerº   Ú_backward_hooksÚ_forward_hooksÚ_forward_pre_hooksÚallÚbuffersrË   rÌ   rÍ   ÚappendÚ
parametersr¬   r"   r   r   rl   rf   rd   Útree_leavesrÆ   r¾   r   Útree_flattenÚreversedr‡   ÚreverseÚ	enumeraterÜ   rµ   )+r   r€   r�   r‚   r.   Újust_one_callableÚ_sample_argsÚflatten_sample_argsÚcrw   Úflatten_argÚper_callable_len_user_argsÚper_callable_module_paramsr–   Ú"per_callable_static_input_surfacesÚ_Ú
fwd_graphsÚ
bwd_graphsÚmempoolrÞ   r³   Úgrad_inputsrš   Úoutputs_gradÚvÚper_callable_static_outputsÚ"per_callable_output_unflatten_specr±   Úfunc_outputsÚflatten_outputsÚspecÚ per_callable_static_grad_outputsÚper_callable_static_grad_inputsr´   r¿   rÁ   rÀ   Úgrad_idxr�   rØ   Úretrà   rä   s+                                              r   r   r   (  sQ  € ôR × Ò ×"Ñ"¤u×'FÒ'F×'HÑ'HÜØmó
ð 	
ð Ðô �i¤×'Ñ'Ø ÐØ�Lˆ	ÜŸš¤E¬&°#¨+Ñ$6¸ÓDÐF‰ä—{’{¤5¬¬v°s¨{Ñ);¸SÐ)@Ñ#AÀ;ÓOˆàÐä�y×/‰ˆÜ�aœŸ™Ÿ™×)Ñ)ä�A×%Ñ%Ó&¨!Ó+Ü˜×(Ñ(Ó)¨QÓ.Ü˜×,Ñ,Ó-°Ó2ðð
]óð3ô ÑE¸¿¹¼ÓE×EÑEð ð-óÐEô
 —k‘k×)Ñ)×9Ò9¸4Ð@ˆØ×"Ñ"¤5¨Ó#5Ô6ÜÑH¹KÓH×HÔHð 	
ðZó	
ÐHñ# 0ñ0 9LÓ!LÒ8K°¤# d¦)Ñ8KÐÐ!Lñ ó"âˆAô ",¨A¬u¯x©x¯©×!?Ñ!?Œˆa�l‰l‹nÔÀRÒGÙð ð "ô ”s˜9“~Ô&ó*â&ˆAð 	ÑÐ!;Ñ!>Ô>Ù&ð 'ð *ô
 38¼¸I»Ô2GÓHÒ2G¨Q”%—*‘*×&Ñ&Ö(Ñ2G€JÐHÜ27¼¸I»Ô2GÓHÒ2G¨Q”%—*‘*×&Ñ&Ö(Ñ2G€JÐHà%)¡\ÔÔ!°t€Gô
 
‡J�J×ÑÔÜ	�‰×	Ñ	œ5Ÿ:™:×,Ñ,Ó.Õ	/Ü03ØÐ%Gö1
Ñ,ˆD�$Ð,ð 2BÑ.ˆK˜ ,ÜÐ+Ö,�ÜŸ+™+×-Ñ-×9Ñ9¹$À¸+ÓF�Ü$Ñ$K±Ó$KÓK�Ü�|Ó$ qÕ(Ü"'§.¡.×"5Ñ"5Ø ,Ü$ñ %Ù';ó%ó  ô &+ñ +Ù9@ó+ó &ð %)Ø%7ð #6ð 
#’Kñ	 -ð ˜|¨[Ó9�Úó :ñ'1
÷ 
0ô. 
‡J�J×ÑÔð #%ÐØ)+Ð&Ü!$ Y¸jÖ!IÑˆˆd�IÜ�Z‰Z×Ñ˜i¨gÐÒ6Ù ˜;ˆL÷ 7ô !&§¡× 3Ñ 3× @Ñ @ÀÓ NÑˆ˜Ø#×*Ñ*¬5°Ó+AÔBØ*×1Ñ1°$Ö7ñ "Jð (*Ð$Ø&(Ð#Ü;>ÜÐ3Ó4ÜÐ,Ó-Ü�Ó÷<Ñ7Ð˜n¨iô $ñ $
ÙFTó$
ó 
Ðô ÑJ©ÓJÓJˆØˆÜˆ|Ó˜qÓ Ü—‘×!Ñ! )°'Ð!Ò:Ü#Ÿn™n×1Ñ1Ø(Ü Ñ TÑ,@Ó TÓTÜ!&Ñ&WÑ2EÓ&WÓ!WØ $Ø!3ð 2ð �÷ ;ð  ÐØˆÛ'ˆCØ× ×  [Ñ%<Ø"×)Ñ)¨+°hÑ*?Ô@Ø˜A‘’à"×)Ñ)¨$Ö/ñ (ô #Ð#5Ó6Ðà(×/Ñ/Ð0CÔDØ'×.Ñ.Ð/A×BñK<ðP %×,Ñ,Ô.Ø#×+Ñ+Ô-ð4Øð4àð4ð 6ð4ð ð	4ð
  <ð4ð 1ð4ð +ð4ð :ð4ð /ð4ð 
ô4ðn $&€CÜ˜YÖ'‰ˆˆ4Ù0Ø�q‰MØ�q‰MØ&Ñ)Ø&Ñ)Ø.¨qÑ1Ø.Ñ1Ø'¨Ñ*Ø,¨QÑ/Ø+¨AÑ.ó

ˆô �dœEŸH™HŸO™O×,Ñ,ðØ%ðà&*ðð *ðð +ð	ð
 "ôñ  0Ø�d—m‘m W¨d¯l©lóˆDŒLð �J‰J�tÖà�J‰J�wÖñI (öL Ø�1‰vˆä�‹:ÐùòW "Mùò"ùò*ùò
 IùÚH÷ 
0Ö	/ú÷B 7Ö6ú÷0 ;Ö:úsL   Ç\?Ç,A]É]	É=(]Ê=(]ÍA3]ÏA]Ñ7]*Õ'A]<Ý
]'Ý*
]9	Ý<
^	)rP   rO   rV   )é   FN)r   r|   r€   rÄ   r�   rW   r‚   rO   r.   rR   rP   r|   )r   útuple[_ModuleOrCallable, ...]r€   ztuple[tuple[Tensor, ...], ...]r�   rW   r‚   rO   r.   rR   rP   r  )r   ú7Union[_ModuleOrCallable, tuple[_ModuleOrCallable, ...]]r€   z9Union[tuple[Tensor, ...], tuple[tuple[Tensor, ...], ...]]r�   rW   r‚   rO   r.   rR   rP   r  )'Ú
__future__r   rp   rê   Úcollections.abcr   r   r   r   r   r	   Útyping_extensionsr
   r   r   r!   r   Ú
torch.cudar   Ú_utilsr   Ú__all__r   r   ÚhasattrÚ_CÚ__dict__Útorch._Cr   r   r   r   r   r   r   ry   r|   rz   r   r   r   r   Ú<module>r     s  ðæ "ã 	Û Ý $ß FÕ Fß 6Ñ 6ã Ý ö å'å  ò€ñ ˆTƒ]€Ùˆtƒ_€ñ ˆu�x‰xÐ*×+Ñ+á&1°,Ó&?€E‡H�H×Ñ�lÑ#Ù.9Ð:NÓ.O€E‡H�H×ÑÐ*Ñ+Ù:EØ(ó;€E‡H�H×ÑÐ6Ñ7÷ñ ô,ô9ôq-�—‘×#Ñ#ô q-÷hS(ñ S(ðn  %Ð%6¸ÀÀfÀÑ8MÐ%MÑNÐ �9Ó Nð 
ð Ø$Ø#'ðØ ðà#ðð ðð ð	ð
 !ðð ôó 
ðð 
ð Ø$Ø#'ð(Ø,ð(à/ð(ð ð(ð ð	(ð
 !ð(ð #ô(ó 
ð(ð Ø$Ø#'ð}ØFð}àJð}ð ð}ð ð	}ð
 !ð}ð =ö}r   