ó
    "Eñi¬W  ã                  ó¨  • % S SK J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\" \R0                  S5      (       d]  \" S5      \R0                  R2                  S'   \" S5      \R0                  R2                  S'   \" S5      \R0                  R2                  S'   S SKJrJrJr  SS jrS S jr " S S\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ÚXPUGraphÚgraphÚmake_graphed_callablesÚ_RÚ_PÚ_XpuStreamBaseÚ	_XPUGraphÚ_xpu_graph_pool_handleÚ_xpu_isCurrentStreamCapturing)r   r   r   c                 ó   • [        5       $ )zÁReturn True if XPU graph capture is underway on the current XPU stream, False otherwise.

If a XPU context does not exist on the current device, returns False without initializing the context.
)r   © ó    ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/xpu/graphs.pyr   r   )   s   € ô
 )Ó*Ð*r   c                 óP   • [         R                  R                  [        5       5      $ )zBReturn an opaque token representing the id of a graph memory pool.)ÚtorchÚxpur   r   r   r   r   r   r   1   s   € ä�9‰9×!Ñ!Ô"8Ó":Ó;Ð;r   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   é6   aÔ  Wrapper around a XPU graph.

Arguments:
    keep_graph (bool, optional): If ``keep_graph=False``, the
        executable command graph will be instantiated on GPU at the end of
        ``capture_end`` and the underlying modifiable command graph will be
        destroyed. Note that the executable command graph 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``.

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

Typically, you shouldn't call ``capture_begin`` yourself.
Use :class:`~torch.xpu.graph`, which call ``capture_begin`` internally.

Arguments:
    pool (optional): Token (returned by :func:`~torch.xpu.graph_pool_handle` or
        :meth:`other_Graph_instance.pool()<torch.xpu.XPUGraph.pool>`) that hints this graph may share memory
        with the indicated pool.
©ÚpoolN)r'   Úcapture_begin)Úselfr/   r+   s     €r   r0   ÚXPUGraph.capture_beginJ   s   ø€ ô 	‰Ñ 4ÐÒ(r   c                ó"   >• [         TU ]  5         g)zïEnd XPU 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.xpu.graph`, which call ``capture_end`` internally.
N)r'   Úcapture_end©r1   r+   s    €r   r4   ÚXPUGraph.capture_endW   s   ø€ ô 	‰ÑÕr   c                ó"   >• [         TU ]  5         g)a  Instantiate the XPU 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 xpu modify command graph returned
by ``raw_xpu_graph``.
N)r'   Úinstantiater5   s    €r   r8   ÚXPUGraph.instantiatea   s   ø€ ô 	‰ÑÕr   c                ó"   >• [         TU ]  5         g)z+Replay the XPU work captured by this graph.N)r'   Úreplayr5   s    €r   r;   ÚXPUGraph.replayj   s   ø€ ä‰‰Õr   c                ó"   >• [         TU ]  5         g)z1Delete the graph currently held by this instance.N)r'   Úresetr5   s    €r   r>   ÚXPUGraph.resetn   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/   ÚXPUGraph.poolr   s   ø€ ô ‰w‰|‹~Ðr   c                ó    >• [         TU ]  5       $ )z.Enable debugging mode for XPUGraph.debug_dump.)r'   Úenable_debug_moder5   s    €r   rC   ÚXPUGraph.enable_debug_modez   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 XPUGraph.enable_debug_mode()
)r'   Ú
debug_dump)r1   Ú
debug_pathr+   s     €r   rF   ÚXPUGraph.debug_dump~   s   ø€ ô ‰wÑ! *Ó-Ð-r   c                ó    >• [         TU ]  5       $ )zuReturns the underlying xpuGraph_t. ``keep_graph`` must be True.

XPU doesn't provide APIs to manipulate this object.
)r'   Úraw_xpu_graphr5   s    €r   rJ   ÚXPUGraph.raw_xpu_graphˆ   s   ø€ ô
 ‰wÑ$Ó&Ð&r   c                ó    >• [         TU ]  5       $ )až  Returns the underlying xpuGraphExec_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_xpu_graph_exec()``, the previously returned xpuGraphExec_t will be destroyed. It is your responsibility not to use this object after destruction.

XPU doesn't provide APIs to manipulate this object.
)r'   Úraw_xpu_graph_execr5   s    €r   rM   ÚXPUGraph.raw_xpu_graph_exec�   s   ø€ ô
 ‰wÑ)Ó+Ð+r   r   )F)r*   ÚboolÚreturnr   r&   )r/   úOptional[_POOL_HANDLE]rP   ÚNone©rP   rR   ©rP   r   )rG   ÚstrrP   rR   )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   6   sN   ø† ñ÷ 0ñ 0÷)ñ )÷÷÷÷÷÷+÷.÷'÷,õ ,r   r   c                  óX   • \ 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   é—   a^  Context-manager that captures XPU work into a :class:`torch.xpu.XPUGraph` object for later replay.

Arguments:
    xpu_graph (torch.xpu.XPUGraph): Graph object used for capture.
    pool (optional): Opaque token (returned by a call to :func:`~torch.xpu.graph_pool_handle()` or
        :meth:`other_Graph_instance.pool()<torch.xpu.XPUGraph.pool>`) hinting this graph's capture
        may share memory from the specified pool.
    stream (torch.xpu.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.

.. 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.

NúOptional[torch.xpu.Stream]Údefault_capture_streamc                óD  • 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U R                  U l        Xl	        g )Nr   zcapture_stream must not be None)
r+   ra   r!   r"   ÚStreamr/   Úcapture_streamÚAssertionErrorÚ
stream_ctxÚ	xpu_graph)r1   rg   r/   Ústreams       r   Ú__init__Úgraph.__init__ª   s‹   € ð �>‰>×0Ñ0Ñ8Ü49·I±I×4DÑ4DÓ4FˆD�N‰NÔ1ð ‘,‰B T Gð 	Œ	ð Ñ(‰F¨d¯n©n×.SÑ.Sð 	Ôð ×ÑÑ&Ü Ð!BÓCÐCØ×-Ñ-ˆŒØ"�r   c                óö   • [         R                  R                  5         [         R                  R                  5         U R                  R                  5         U R                  R                  " U R                  6   g r&   )	r!   r"   ÚsynchronizeÚempty_cacherf   Ú	__enter__rg   r0   r/   )r1   s    r   rn   Úgraph.__enter__Á   sH   € ä�	‰	×ÑÔä�	‰	×ÑÔØ�‰×!Ñ!Ô#à�‰×$Ò$ d§i¡iÒ0r   c                ój   • U R                   R                  5         U R                  R                  " U6   g r&   )rg   r4   rf   Ú__exit__)r1   Úargss     r   rq   Úgraph.__exit__Ê   s$   € Ø�‰×"Ñ"Ô$Ø�‰× Ò  $Ò'r   )rd   r/   rf   rg   )NN)rg   r   r/   rQ   rh   r`   rS   )rr   ÚobjectrP   rR   )rW   rX   rY   rZ   r[   ra   Ú__annotations__ri   rn   rq   r\   r   r   r   r   r   —   sH   ‡ ñð  :>ÐÐ6Ó=ð
 (,Ø-1ð	#àð#ð %ð#ð +õ	#ô.1÷(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   ry   s        r   r   r   Ü   s   € ð %(r   c                ó4  • [         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[1        [        U 5      5       Vs/ s H  nX}   XÍ   -   PM     nn[1        [        U 5      5       Vs/ s H!  n[         R2                  R5                  5       PM#     nn[1        [        U 5      5       Vs/ s H!  n[         R2                  R5                  5       PM#     nnUc
  [7        5       OUn[         R2                  R9                  5         [         R2                  R;                  [         R2                  R=                  5       5         [        XU5       H¼  u  nn	nSu  nnn[1        U5       H“  n[         R$                  R&                  R?                  U" U	6 5      n[        S U 5       5      n[        U5      S:”  d  MR  [         R@                  RC                  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        [         R2                  R9                  5         / n/ n[        XU5       HŠ  u  nn	n[         R2                  RE                  UUS9   U" U	6 nSSS5        [         R$                  R&                  RG                  W5      u  nnUR+                  [        U5      5        UR+                  U5        MŒ     / n/ n [        [I        U5      [I        U5      [I        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  [         R2                  RE                  U"US9   [         R@                  RC                  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&RJ                  (       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RM                  5         U RM                  5                             SS jn'/ n([O        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RP                  U)URR                  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 XPU work as a XPU 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 XPU 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.

Arguments:
    callables (torch.nn.Module or Python function, or tuple of these): Callable or callables to graph.
        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.xpu.graph_pool_handle` or
        :meth:`other_Graph_instance.pool()<torch.xpu.XPUGraph.pool>`) that hints this graph may share memory
        with the indicated pool.
.. 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.xpu.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.xpu.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.xpu.make_graphed_callables` only with disabled
    caching. The context manager `torch.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>I  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‡   Q  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‡   q  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‡   u  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‡   x  s(   é € ð +Ú9@°AÇOÅOÓ/œE×,Ò,¨Q×/Ð/ºùs   ‚7š7)ÚoutputsÚinputsÚgrad_outputsÚonly_inputsÚallow_unusedr.   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)zOmake_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  [        S5      e[        S T 5       5      $ )Nzstatic_outputs must be a tuplec              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ÚRuntimeError)Ú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Ü&Ð'GÓHÐHÜÑ@±Ó@Ó@Ð@r   c                óœ  >• [        U5      [        T5      :w  a#  [        S[        T5       S[        U5       35      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  [        S5      e[        S T 5       5      $ )Nz	Expected z gradients but got z"static_grad_inputs must be a tuplec              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   ‚"$)Úlenrª   Ú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Â   ø€ ô �u“:¤Ð%8Ó!9Ó9Ü&Ø#¤CÐ(;Ó$<Ð#=Ð=PÔQTÐUZÓQ[ÐP\Ð]óð ô  #Ð#6¸Ö>‘G�AØ“}ØŸ:™:›<¨4¯=©=«?Õ:ØŸG™G DžMñ  ?ð × Ñ Ô"ä!Ð"4´e×<Ñ<Ü&Ð'KÓLÐLÜñ ñ 0óó ð r   r   N)r«   rt   r–   r   rP   útuple[Tensor, ...])r«   rt   r·   r   rP   r¿   )rW   rX   rY   rZ   Ústaticmethodr°   r!   ÚautogradÚfunctionÚonce_differentiabler½   r\   )rº   r¬   r­   r»   r¼   r®   r¯   s   €€€€€€€r   ÚGraphedÚOmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.GraphedÃ  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>.functionalizedæ  sU   ø€ ä %§¡× 3Ñ 3× CÒ CÀYÐ OÐØ—-’-¤%Ð(9Ó":¸]Ñ"JÐLˆCÜ—;‘;×&Ñ&×5Ñ5°cÐ;PÓQÐQr   )rÌ   rt   rP   rt   )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×-Ñ-ô !	÷F	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_fwd  s0   ø€ Ø—}‘}Ð(<Ó<Ù&¨	Ð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_forwardþ  s   û€ ÷Cò Cð �r   )r¬   r   rº   r   rÏ   ztuple[torch.nn.Parameter, ...]r­   rV   rÐ   ztorch.utils._pytree.TreeSpecr®   r¿   r¯   r¿   r¼   ztuple[Optional[Tensor], ...]r»   r¿   rP   zCallable[..., object])
rÚ   rv   rÛ   rO   rÜ   úCallable[_P, _R]rÝ   râ   rP   râ   )*r!   Úis_autocast_enabledÚis_autocast_cache_enabledrª   r‰   r©   ÚtypingÚcastr   r¶   ÚnnÚModulerµ   Ú_backward_hooksÚ_forward_hooksÚ_forward_pre_hooksÚallÚbuffersrÇ   rÈ   rÉ   ÚappendÚ	TypeErrorÚ
parametersr¦   r"   r   r   rl   rh   rc   Útree_leavesrÁ   r¹   r   Útree_flattenÚreversedr‚   ÚreverseÚ	enumeraterØ   r°   )+rz   r{   r|   r}   r/   Újust_one_callableÚ_sample_argsÚflatten_sample_argsÚcrr   Ú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   æ   sH  € ôN × Ò ×"Ñ"¤u×'FÒ'F×'HÑ'HÜØmó
ð 	
ð Ðô �i¤×'Ñ'Ø ÐØ�Lˆ	ÜŸš¤E¬&°#¨+Ñ$6¸ÓDÐF‰ä—{’{¤5¬¬v°s¨{Ñ);¸SÐ)@Ñ#AÀ;ÓOˆàÐä�y×/‰ˆÜ�aœŸ™Ÿ™×)Ñ)ä�A×%Ñ%Ó&¨!Ó+Ü˜×(Ñ(Ó)¨QÓ.Ü˜×,Ñ,Ó-°Ó2ä"ðaóð ô ÑE¸¿¹¼ÓE×EÑEÜ"ð1óð ô
 —k‘k×)Ñ)×9Ò9¸4Ð@ˆØ×"Ñ"¤5¨Ó#5Ô6ÜÑH¹KÓH×HÔHÜð^óð ñ) 0ñ6 9LÓ!LÒ8K°¤# d¦)Ñ8KÐÐ!Lñ ó"âˆAô ",¨A¬u¯x©x¯©×!?Ñ!?Œˆa�l‰l‹nÔÀRÒGÙð ð "ô ”s˜9“~Ô&ó*â&ˆAð 	ÑÐ!;Ñ!>Ô>Ù&ð 'ð *ô
 16´c¸)³nÔ0EÓFÒ0E¨1”%—)‘)×$Ñ$Ö&Ñ0E€JÐFÜ05´c¸)³nÔ0EÓFÒ0E¨1”%—)‘)×$Ñ$Ö&Ñ0E€JÐFà%)¡\ÔÔ!°t€Gô 
‡I�I×ÑÔÜ	�‰×	Ñ	œ%Ÿ)™)×*Ñ*Ó,Õ	-Ü03ØÐ%Gö1
Ñ,ˆD�$Ð,ð 2BÑ.ˆK˜ ,ÜÐ+Ö,�ÜŸ+™+×-Ñ-×9Ñ9¹$À¸+ÓF�Ü$Ñ$K±Ó$KÓK�Ü�|Ó$ qÕ(Ü"'§.¡.×"5Ñ"5Ø ,Ü$ñ %Ù';ó%ó  ô &+ñ +Ù9@ó+ó &ð %)Ø%7ð #6ð 
#’Kñ	 -ð ˜|¨[Ó9�Úó :ñ'1
÷ 
.ô. 
‡I�I×ÑÔð #%ÐØ)+Ð&Ü!$ Y¸jÖ!IÑˆˆd�Iä�Y‰Y�_‰_˜Y¨Wˆ_Ò5Ù ˜;ˆL÷ 6ô !&§¡× 3Ñ 3× @Ñ @ÀÓ NÑˆ˜Ø#×*Ñ*¬5°Ó+AÔBØ*×1Ñ1°$Ö7ñ "Jð (*Ð$Ø&(Ð#Ü;>ÜÐ3Ó4ÜÐ,Ó-Ü�Ó÷<Ñ7Ð˜n¨iô
 $ñ $
ÙFTó$
ó 
Ðô ÑJ©ÓJÓJˆØˆÜˆ|Ó˜qÓ Ü—‘—‘ °�Ò9Ü#Ÿn™n×1Ñ1Ø(Ü Ñ TÑ,@Ó TÓTÜ!&Ñ&WÑ2EÓ&WÓ!WØ $Ø!3ð 2ð �÷ :ð  ÐØˆÛ'ˆCØ× ×  [Ñ%<Ø"×)Ñ)¨+°hÑ*?Ô@Ø˜A‘’à"×)Ñ)¨$Ö/ñ (ô #Ð#5Ó6Ðà(×/Ñ/Ð0CÔDØ'×.Ñ.Ð/A×BñA<ðF %×,Ñ,Ô.Ø#×+Ñ+Ô-ð4Øð4àð4ð 6ð4ð ð	4ð
  <ð4ð 1ð4ð +ð4ð :ð4ð /ð4ð 
ô4ðl $&€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ÖñE (öH Ø�1‰vˆä�‹:Ðùò{ "Mùò"ùò*ùò
 GùÚF÷ 
.Ö	-ú÷< 6Ö5ú÷, :Ö9úsL   Ç]Ç8A]É]Ê	(]Ë	(]ÍA3]$ÏA]$Ò]6Õ3A^Ý$
]3Ý6
^	Þ
^	)rP   rO   rT   )é   FN)rz   rw   r{   r¿   r|   rV   r}   rO   r/   rQ   rP   rw   )rz   útuple[_ModuleOrCallable, ...]r{   ztuple[tuple[Tensor, ...], ...]r|   rV   r}   rO   r/   rQ   rP   r  )rz   ú7Union[_ModuleOrCallable, tuple[_ModuleOrCallable, ...]]r{   z9Union[tuple[Tensor, ...], tuple[tuple[Tensor, ...], ...]]r|   rV   r}   rO   r/   rQ   rP   r  )&Ú
__future__r   rå   Úcollections.abcr   r   r   r   r   r	   Útyping_extensionsr
   r   r   r!   r   Ú	torch.xpur   Ú_utilsr   Ú__all__r   r   ÚhasattrÚ_CÚ__dict__Útorch._Cr   r   r   r   r   r   r   rt   rw   ru   r   r   r   r   Ú<module>r     sô  ðÞ "ã Ý $ß FÕ Fß 6Ñ 6ã Ý ö Ý&å  ò€ñ ˆTƒ]€Ùˆtƒ_€áˆu�x‰xÐ)×*Ñ*á%0°Ó%=€E‡H�H×Ñ�kÑ"Ù2=Ð>VÓ2W€E‡H�H×ÑÐ.Ñ/Ù9DØ'ó:€E‡H�H×ÑÐ5Ñ6÷
 VÑ Uô+ô<ô
^,ˆyô ^,÷B5(ñ 5(ðp  %Ð%6¸ÀÀfÀÑ8MÐ%MÑNÐ �9Ó Nð 
ð Ø$Ø#'ðØ ðà#ðð ðð ð	ð
 !ðð ôó 
ðð 
ð Ø$Ø#'ð(Ø,ð(à/ð(ð ð(ð ð	(ð
 !ð(ð #ô(ó 
ð(ð Ø$Ø#'ðpØFðpàJðpð ðpð ð	pð
 !ðpð =öpr   