§
    Ÿ²ÅjaX  ã                   óP  — d dl Z d dlZd dlZddlmZ  eej        d¦  «        sH ed¦  «        ej        j        d<    ed¦  «        ej        j        d<    ed¦  «        ej        j        d<   d dlm	Z	m
Z
mZ d	„ Zd
„ Z G d„ dej        j
        ¦  «        Z G d„ d¦  «        Z	 dd„ZdS )é    Né   )Ú_dummy_typeÚ_CudaStreamBaseÚ
_CUDAGraphÚ_graph_pool_handleÚ_cuda_isCurrentStreamCapturing)r   r   r   c                  ó   — t          ¦   «         S )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   © ó    úBC:\Projects\Historical\venv\Lib\site-packages\torch/cuda/graphs.pyÚis_current_stream_capturingr      s   € õ
 *Ñ+Ô+Ð+r   c                  ó   — t          ¦   «         S )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.
    )r   r
   r   r   Úgraph_pool_handler   "   s   € õ ÑÔÐr   c                   ój   ‡ — e Zd ZdZˆ fd„Zdˆ fd„	Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd	„Z	ˆ fd
„Z
ˆ fd„Zˆ xZS )Ú	CUDAGraphzrWrapper around a CUDA graph.

    .. warning::
        This API is in beta and may change in future releases.
    c                 óF   •— t          ¦   «                              | ¦  «        S ©N)ÚsuperÚ__new__)ÚclsÚ	__class__s    €r   r   zCUDAGraph.__new__5   s   ø€ Ý‰wŒw�Š˜sÑ#Ô#Ð#r   NÚglobalc                 óN   •— t          ¦   «                              ||¬¦  «         dS )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   r   zCUDAGraph.capture_begin8   s)   ø€ õ" 	‰Œ×Ò 4Ð<NÐÑOÔOÐOÐOÐOr   c                 óH   •— t          ¦   «                              ¦   «          dS )aG  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©r   r   s    €r   r   zCUDAGraph.capture_endK   s!   ø€ õ 	‰Œ×ÒÑÔÐÐÐr   c                 óH   •— t          ¦   «                              ¦   «          dS )z,Replay the CUDA work captured by this graph.N)r   Úreplayr    s    €r   r"   zCUDAGraph.replayV   s   ø€ å‰Œ�ŠÑÔÐÐÐr   c                 óH   •— t          ¦   «                              ¦   «          dS )z1Delete the graph currently held by this instance.N)r   Úresetr    s    €r   r$   zCUDAGraph.resetZ   s   ø€ å‰Œ�Š‰Œˆˆˆr   c                 óD   •— t          ¦   «                              ¦   «         S )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   r    s    €r   r   zCUDAGraph.pool^   s   ø€ õ ‰wŒw�|Š|‰~Œ~Ðr   c                 óD   •— t          ¦   «                              ¦   «         S )z/Enable debugging mode for CUDAGraph.debug_dump.)r   Úenable_debug_moder    s    €r   r'   zCUDAGraph.enable_debug_modef   s   ø€ å‰wŒw×(Ò(Ñ*Ô*Ð*r   c                 óF   •— t          ¦   «                              |¦  «        S )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)r   Ú
debug_pathr   s     €r   r)   zCUDAGraph.debug_dumpj   s   ø€ õ ‰wŒw×!Ò! *Ñ-Ô-Ð-r   )Nr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r"   r$   r   r'   r)   Ú__classcell__)r   s   @r   r   r   .   sü   ø€ € € € € ðð ð$ð $ð $ð $ð $ðPð Pð Pð Pð Pð Pð&	ð 	ð 	ð 	ð 	ðð ð ð ð ðð ð ð ð ðð ð ð ð ð+ð +ð +ð +ð +ð.ð .ð .ð .ð .ð .ð .ð .ð .r   r   c                   óX   — e Zd ZU dZdZej        d         ed<   	 	 	 d
defd„Z	d„ Z
d	„ ZdS )ÚgraphaÅ  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
    Nztorch.cuda.StreamÚdefault_capture_streamr   r   c                 ó0  — | j         j        €(t          j                             ¦   «         | j         _        |€dn|f| _        |�|n| j         j        | _        | j        €J ‚t          j                             | j        ¦  «        | _        || _	        || _
        d S )Nr
   )r   r2   ÚtorchÚcudaÚStreamr   Úcapture_streamÚstreamÚ
stream_ctxÚ
cuda_graphr   )r   r:   r   r8   r   s        r   Ú__init__zgraph.__init__•   s‘   € ð Œ>Ô0Ð8Ý49´J×4EÒ4EÑ4GÔ4GˆDŒNÔ1à˜,�B�B¨T¨GˆŒ	àÐ(ˆFˆF¨d¬nÔ.Sð 	Ôð Ô"Ð.Ð.Ð.Ýœ*×+Ò+¨DÔ,?Ñ@Ô@ˆŒØ$ˆŒØ"4ˆÔÐÐr   c                 ó  — t           j                             ¦   «          t          j        ¦   «          t           j                             ¦   «          | j                             ¦   «           | j        j	        | j
        d| j        iŽ d S )Nr   )r4   r5   ÚsynchronizeÚgcÚcollectÚempty_cacher9   Ú	__enter__r:   r   r   r   )r   s    r   rA   zgraph.__enter__«   s~   € åŒ
×ÒÑ Ô Ð Ý
Œ
‰ŒˆÝŒ
×ÒÑ Ô Ð ð 	Œ×!Ò!Ñ#Ô#Ð#à%ˆŒÔ%ØŒYð	
Ø+/Ô+Bð	
ð 	
ð 	
ð 	
ð 	
r   c                 óp   — | j                              ¦   «          | j                             |||¦  «         d S r   )r:   r   r9   Ú__exit__)r   Úexc_typeÚ	exc_valueÚ	tracebacks       r   rC   zgraph.__exit__¹   s6   € ØŒ×#Ò#Ñ%Ô%Ð%ØŒ× Ò  ¨9°iÑ@Ô@Ð@Ð@Ð@r   )NNr   )r+   r,   r-   r.   r2   ÚtypingÚOptionalÚ__annotations__Ústrr;   rA   rC   r
   r   r   r1   r1   u   sŽ   € € € € € € ðð ð: DHÐ˜FœOÐ,?Ô@ÐGÐGÑGð
 ØØ"*ð5ð 5ð
  ð5ð 5ð 5ð 5ð,
ð 
ð 
ðAð Að Að Að Ar   r1   é   Fc                 ó¾  ‡'‡(— t          j        ¦   «         r"t          j        ¦   «         rt          d¦  «        ‚d}t	          | t
          ¦  «        sd}| f} |f}g Š't          | |¦  «        D �]	\  }}t	          |t           j        j        ¦  «        r‡t          |j
        ¦  «        dk    r0t          |j        ¦  «        dk    rt          |j        ¦  «        dk    s
J d¦   «         ‚t          d„ |                     ¦   «         D ¦   «         ¦  «        s
J d¦   «         ‚t          j        j        j        |Ž }‰'                     t          |¦  «        ¦  «         t          d„ |D ¦   «         ¦  «        s
J d	¦   «         ‚�Œd
„ ‰'D ¦   «         }	d„ | D ¦   «         Š(ˆ'ˆ(fd„t'          t          | ¦  «        ¦  «        D ¦   «         }
d„ t'          t          | ¦  «        ¦  «        D ¦   «         }d„ t'          t          | ¦  «        ¦  «        D ¦   «         }|€t)          ¦   «         n|}t           j                             ¦   «          t           j                             t           j                             ¦   «         ¦  «        5  t          | ||
¦  «        D ]Ì\  }}}d\  }}}t'          |¦  «        D ]§}t           j        j                              ||Ž ¦  «        }t          d„ |D ¦   «         ¦  «        }t          |¦  «        dk    rRt           j                             |t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        d|¬¦  «        }Œ¨|||fD ]}~ŒŒÍ	 ddd¦  «         n# 1 swxY w Y   t           j                             ¦   «          g }g }t          | ||¦  «        D ]¢\  }}}t           j                             ||¬¦  «        5   ||Ž }ddd¦  «         n# 1 swxY w Y   t           j        j                             |¦  «        \  }}|                     t          |¦  «        ¦  «         |                     |¦  «         Œ£g }g }t          t=          |
¦  «        t=          |¦  «        t=          |¦  «        ¦  «        D �]Z\  }}}t          d„ |D ¦   «         ¦  «        }t          d„ |D ¦   «         ¦  «        }d}t          |¦  «        dk    r‹t           j                             ||¬¦  «        5  t           j                             |t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        d|¬¦  «        }ddd¦  «         n# 1 swxY w Y   g }d} |D ]A}!|!j        r#|�!|                     ||          ¦  «         | dz  } Œ,|                     d¦  «         ŒBt          |¦  «        }|                     |¦  «         |                     |¦  «         �Œ\|                      ¦   «          |                      ¦   «          d„ }"g }#tC          | ¦  «        D ]¸\  }$} |"||$         ||$         ‰(|$         |	|$         ||$         |
|$         ||$         ||$         ||$         ¦	  «	        }%t	          |t           j        j        ¦  «        r6d„ }& |&||j"        |%|j#        ¦  «        |_#        |#                     |¦  «         Œ£|#                     |%¦  «         Œ¹|r|#d         S t          |#¦  «        S )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`.FTr   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   ó(   K  — | ]}|j         d u V — ŒdS )FN©Úrequires_grad©Ú.0Úbs     r   ú	<genexpr>z)make_graphed_callables.<locals>.<genexpr>  s)   è è € ÐEÐE°A�q”¨%Ð/ÐEÐEÐEÐEÐEÐEr   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   óJ   K  — | ]}t          |t          j        ¦  «        V — Œd S r   )Ú
isinstancer4   ÚTensor)rQ   Úargs     r   rS   z)make_graphed_callables.<locals>.<genexpr>#  s.   è è € ÐHÐH°S•:˜c¥5¤<Ñ0Ô0ÐHÐHÐHÐHÐHÐHr   zfIn the beta API, sample_args for each callable must contain only Tensors. Other types are not allowed.c                 ó,   — g | ]}t          |¦  «        ‘ŒS r
   )Úlen)rQ   Úargss     r   ú
<listcomp>z*make_graphed_callables.<locals>.<listcomp>*  s   € Ð!LÐ!LÐ!L°¥# d¡)¤)Ð!LÐ!LÐ!Lr   c                 ó’   — g | ]D}t          |t          j        j        ¦  «        r!t	          |                     ¦   «         ¦  «        nd ‘ŒES )r
   )rU   r4   ÚnnÚModuleÚtupleÚ
parameters)rQ   Úcs     r   r[   z*make_graphed_callables.<locals>.<listcomp>+  sP   € ð "ð "ð "àõ ",¨A­u¬x¬Ñ!?Ô!?ÐG�ˆa�lŠl‰nŒnÑÔÐÀRð"ð "ð "r   c                 ó2   •— g | ]}‰|         ‰|         z   ‘ŒS r
   r
   )rQ   ÚiÚflatten_sample_argsÚper_callable_module_paramss     €€r   r[   z*make_graphed_callables.<locals>.<listcomp>/  s9   ø€ ð *ð *ð *àð 	˜AÔÐ!;¸AÔ!>Ñ>ð*ð *ð *r   c                 óJ   — g | ] }t           j                             ¦   «         ‘Œ!S r
   ©r4   r5   r   ©rQ   Ú_s     r   r[   z*make_graphed_callables.<locals>.<listcomp>4  ó&   € ÐHÐHÐH¨Q•%”*×&Ò&Ñ(Ô(ÐHÐHÐHr   c                 óJ   — g | ] }t           j                             ¦   «         ‘Œ!S r
   rg   rh   s     r   r[   z*make_graphed_callables.<locals>.<listcomp>5  rj   r   N)NNNc              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rN   ©rQ   Úos     r   rS   z)make_graphed_callables.<locals>.<genexpr>D  s)   è è € Ð$KÐ$K¨1¸1¼?Ð$K QÐ$KÐ$KÐ$KÐ$KÐ$KÐ$Kr   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rN   ©rQ   rc   s     r   rS   z)make_graphed_callables.<locals>.<genexpr>H  s=   è è € ð %ð %Ø"#¸q¼ð%Øð%ð %ð %ð %ð %ð %r   c              3   óL   K  — | ]}|j         ¯	t          j        |¦  «        V — Œ d S r   ©rO   r4   Ú
empty_likerm   s     r   rS   z)make_graphed_callables.<locals>.<genexpr>K  sH   è è € ð +ð +Ø45ÀAÄOð+Ý!Ô,¨QÑ/Ô/ð+ð +ð +ð +ð +ð +r   )ÚoutputsÚinputsÚgrad_outputsÚonly_inputsÚallow_unused)r   c              3   óP   K  — | ]!}|j         rt          j        |¦  «        nd V — Œ"d S r   rr   rm   s     r   rS   z)make_graphed_callables.<locals>.<genexpr>o  sJ   è è € ð $
ð $
ØAB 1¤?Ð<�EÔ˜QÑÔÐ¸ð$
ð $
ð $
ð $
ð $
ð $
r   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rN   rm   s     r   rS   z)make_graphed_callables.<locals>.<genexpr>s  s)   è è € ÐJÐJ 1¸!¼/ÐJ˜QÐJÐJÐJÐJÐJÐJr   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rN   rp   s     r   rS   z)make_graphed_callables.<locals>.<genexpr>y  s)   è è € Ð TÐ T qÀAÄOÐ T Ð TÐ TÐ TÐ TÐ TÐ Tr   c              3   ó   K  — | ]}|®|V — Œ	d S r   r
   rm   s     r   rS   z)make_graphed_callables.<locals>.<genexpr>z  s"   è è € Ð&WÐ&W¨QÈÈ qÈÈÈÈÐ&WÐ&Wr   é   c	           	      ór   ‡ ‡‡‡‡‡‡‡‡‡
—  G ˆˆ ˆˆˆˆˆfd„dt           j        j        ¦  «        Š
ˆ
ˆˆfd„}	|	S )Nc                   ó|   •— e Zd Zeˆˆˆˆfd„¦   «         Zeej        j        j        ˆ ˆˆfd„¦   «         ¦   «         Z	dS )úOmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphedc                 ó^  •— t          ‰¦  «        D ]Y}‰|                              ¦   «         ||                              ¦   «         k    r!‰|                              ||         ¦  «         ŒZ‰                     ¦   «          t	          ‰t
          ¦  «        sJ ‚t          d„ ‰D ¦   «         ¦  «        S )Nc              3   ó>   K  — | ]}|                      ¦   «         V — Œd S r   ©Údetachrm   s     r   rS   zjmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.forward.<locals>.<genexpr>¨  s*   è è € Ð@Ð@¨A˜QŸXšX™ZœZÐ@Ð@Ð@Ð@Ð@Ð@r   )ÚrangeÚdata_ptrÚcopy_r"   rU   r_   )Úctxru   rc   Ú	fwd_graphÚlen_user_argsÚstatic_input_surfaceÚstatic_outputss      €€€€r   ÚforwardzWmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.forward   s­   ø€ õ ˜}Ñ-Ô-ð Að A�AØ+¨AÔ.×7Ò7Ñ9Ô9¸VÀA¼Y×=OÒ=OÑ=QÔ=QÒQÐQØ,¨QÔ/×5Ò5°f¸Q´iÑ@Ô@Ð@øØ× Ò Ñ"Ô"Ð"Ý! .µ%Ñ8Ô8Ð8Ð8Ð8ÝÐ@Ð@°Ð@Ñ@Ô@Ñ@Ô@Ð@r   c                 ó~  •— t          |¦  «        t          ‰¦  «        k    sJ ‚t          ‰|¦  «        D ]F\  }}|�?|                     ¦   «         |                     ¦   «         k    r|                     |¦  «         ŒG‰                     ¦   «          t          ‰t          ¦  «        sJ ‚t          d„ ‰D ¦   «         ¦  «        S )Nc              3   óF   K  — | ]}|�|                      ¦   «         n|V — Œd S r   rƒ   rP   s     r   rS   zkmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.backward.<locals>.<genexpr>¸  sC   è è € ð ð Ø;< ! -�A—H’H‘J”J�J°Qðð ð ð ð ð r   )rY   Úzipr†   r‡   r"   rU   r_   )rˆ   ÚgradsÚgÚgradÚ	bwd_graphÚstatic_grad_inputsÚstatic_grad_outputss       €€€r   ÚbackwardzXmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.backwardª  sÎ   ø€ õ ˜5‘z”z¥SÐ)<Ñ%=Ô%=Ò=Ð=Ð=Ð=Ý"Ð#6¸Ñ>Ô>ð *ð *‘G�A�tØ�}ð Ÿ:š:™<œ<¨4¯=ª=©?¬?Ò:Ð:ØŸGšG D™MœM˜MøØ× Ò Ñ"Ô"Ð"õ "Ð"4µeÑ<Ô<Ð<Ð<Ð<Ýð ð Ø@Rðñ ô ñ ô ð r   N)
r+   r,   r-   Ústaticmethodr�   r4   ÚautogradÚfunctionÚonce_differentiabler—   )r”   r‰   rŠ   r•   r–   r‹   rŒ   s   €€€€€€€r   ÚGraphedr€   Ÿ  s‘   ø€ € € € € ØðAð Að Að Að Að Að Añ Œ\ðAð ØŒ^Ô$Ô8ðð ð ð ð ð ñ 9Ô8ñ Œ\ðð ð r   rœ   c                  ó²   •— t          j        j        j        | Ž } ‰j        t          |¦  «        ‰z   Ž }t           j        j                             |‰¦  «        S r   )r4   ÚutilsÚ_pytreeÚarg_tree_leavesÚapplyr_   Útree_unflatten)Ú	user_argsÚflatten_user_argsÚoutrœ   Úmodule_paramsÚoutput_unflatten_specs      €€€r   ÚfunctionalizedzVmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.functionalized¼  sP   ø€ õ !&¤Ô 3Ô CÀYÐ OÐØ�'”-¥%Ð(9Ñ":Ô":¸]Ñ"JÐLˆCÝ”;Ô&×5Ò5°cÐ;PÑQÔQÐQr   )r4   r™   ÚFunction)r‰   r”   r¦   rŠ   r§   r‹   rŒ   r–   r•   r¨   rœ   s   ````````` @r   Úmake_graphed_autograd_functionz>make_graphed_callables.<locals>.make_graphed_autograd_function”  s•   øøøøøøøøøø€ ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	•e”nÔ-ñ 	ô 	ð 	ð:	Rð 	Rð 	Rð 	Rð 	Rð 	Rð 	Rð Ðr   c                 ó   ‡ ‡‡‡— ˆ ˆˆˆfd„}|S )Nc                  ó.   •— ‰j         ‰k    r ‰| Ž S  ‰| Ž S r   )Útraining)r£   ÚfuncÚgraph_training_stateÚgraphedÚorig_fwds    €€€€r   Únew_fwdzEmake_graphed_callables.<locals>.make_graphed_forward.<locals>.new_fwdØ  s-   ø€ ð ”}Ð(<Ò<Ð<Ø&˜w¨	Ð2Ð2à'˜x¨Ð3Ð3r   r
   )r®   r¯   r°   r±   r²   s   ```` r   Úmake_graphed_forwardz4make_graphed_callables.<locals>.make_graphed_forward×  s5   øøøø€ ð4ð 4ð 4ð 4ð 4ð 4ð 4ð 4ð �r   )$r4   Úis_autocast_enabledÚis_autocast_cache_enabledÚRuntimeErrorrU   r_   r�   r]   r^   rY   Ú_backward_hooksÚ_forward_hooksÚ_forward_pre_hooksÚallÚbuffersrž   rŸ   r    Úappendr…   r   r5   r=   r8   r6   Útree_leavesr™   r“   r1   Útree_flattenÚreversedrO   ÚreverseÚ	enumerater­   r�   ))Ú	callablesÚsample_argsÚnum_warmup_itersÚallow_unused_inputr   Újust_one_callablera   rZ   Úflatten_argÚper_callable_len_user_argsÚ"per_callable_static_input_surfacesÚ
fwd_graphsÚ
bwd_graphsÚmempoolr®   r‹   Úgrad_inputsrt   Úoutputs_gradri   ÚvÚper_callable_static_outputsÚ"per_callable_output_unflatten_specr‰   Úflatten_outputsÚspecÚ per_callable_static_grad_outputsÚper_callable_static_grad_inputsrŒ   r”   r–   r•   Úgrad_idxrW   rª   Úretrc   r°   r³   rd   re   s)                                          @@r   Úmake_graphed_callablesrØ   ¿   s¹  øø€ õJ Ô Ñ"Ô"ð 
¥uÔ'FÑ'HÔ'Hð 
ÝØmñ
ô 
ð 	
ð Ðå�i¥Ñ'Ô'ð %Ø ÐØ�Lˆ	Ø"�nˆàÐå�y +Ñ.Ô.ð 
ñ 
‰ˆˆ4Ý�a�œœÑ)Ô)ð 	å�AÔ%Ñ&Ô&¨!Ò+Ð+Ý˜Ô(Ñ)Ô)¨QÒ.Ð.Ý˜Ô,Ñ-Ô-°Ò2Ð2Ð2ð]ñ 3Ô2ð3õ ÐEÐE¸¿º¹¼ÐEÑEÔEÑEÔEð ð ð-ñô ÐEõ
 ”kÔ)Ô9¸4Ð@ˆØ×"Ò"¥5¨Ñ#5Ô#5Ñ6Ô6Ð6ÝÐHÐH¸KÐHÑHÔHÑHÔHð 	
ð 	
ðZñ	
ô 	
ÐHñ 	
ð "MÐ!LÐ8KÐ!LÑ!LÔ!LÐð"ð "àð"ñ "ô "Ðð*ð *ð *ð *ð *å•s˜9‘~”~Ñ&Ô&ð*ñ *ô *Ð&ð
 IÐHµ%½¸I¹¼Ñ2GÔ2GÐHÑHÔH€JØHÐHµ%½¸I¹¼Ñ2GÔ2GÐHÑHÔH€Jà%) \ÕÑ!Ô!Ð!°t€Gõ
 
„J×ÒÑÔÐÝ	Œ×	Ò	�5œ:×,Ò,Ñ.Ô.Ñ	/Ô	/ð ð Ý03Ø�{Ð$Fñ1
ô 1
ð 	ð 	Ñ,ˆD�$Ð,ð 2BÑ.ˆK˜ ,ÝÐ+Ñ,Ô,ð ð �Ýœ+Ô-×9Ò9¸$¸$À¸+ÑFÔF�Ý$Ð$KÐ$K°Ð$KÑ$KÔ$KÑKÔK�Ý�|Ñ$Ô$ qÒ(Ð(Ý"'¤.×"5Ò"5Ø ,Ý$ð %ð %Ø';ð%ñ %ô %ñ  ô  õ &+ð +ð +Ø9@ð+ñ +ô +ñ &ô &ð %)Ø%7ð #6ñ 
#ô 
#�Køð ˜|¨[Ð9ð ð �Ø�Aðð'	ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ. 
„J×ÒÑÔÐð #%ÐØ)+Ð&Ý!$ Y°¸ZÑ!HÔ!Hð 8ð 8Ñˆˆd�IÝŒZ×Ò˜i¨gÐÑ6Ô6ð 	"ð 	"Ø�d˜D�kˆGð	"ð 	"ð 	"ñ 	"ô 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"øøøð 	"ð 	"ð 	"ð 	"õ !&¤Ô 3× @Ò @ÀÑ IÔ IÑˆ˜Ø#×*Ò*­5°Ñ+AÔ+AÑBÔBÐBØ*×1Ò1°$Ñ7Ô7Ð7Ð7ð (*Ð$Ø&(Ð#Ý;>ÝÐ3Ñ4Ô4ÝÐ,Ñ-Ô-Ý�ÑÔñ<ô <ð %Cñ %CÑ7Ð˜n¨iõ $ð $
ð $
ØFTð$
ñ $
ô $
ñ 
ô 
Ðõ ÐJÐJ¨ÐJÑJÔJÑJÔJˆØˆÝˆ|ÑÔ˜qÒ Ð Ý”×!Ò! )°'Ð!Ñ:Ô:ð ð Ý#œn×1Ò1Ø(Ý Ð TÐ TÐ,@Ð TÑ TÔ TÑTÔTÝ!&Ð&WÐ&WÐ2EÐ&WÑ&WÔ&WÑ!WÔ!WØ $Ø!3ð 2ñ ô �ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð  ÐØˆØ'ð 	0ð 	0ˆCØÔ ð 0 [Ð%<Ø"×)Ò)¨+°hÔ*?Ñ@Ô@Ð@Ø˜A‘��à"×)Ò)¨$Ñ/Ô/Ð/Ð/Ý"Ð#5Ñ6Ô6Ðà(×/Ò/Ð0CÑDÔDÐDØ'×.Ò.Ð/AÑBÔBÐBÑBð %×,Ò,Ñ.Ô.Ð.Ø#×+Ò+Ñ-Ô-Ð-ð0ð 0ð 0ðf €CÝ˜YÑ'Ô'ð  ð  ‰ˆˆ4Ø0Ð0Ø�qŒMØ�qŒMØ& qÔ)Ø& qÔ)Ø.¨qÔ1Ø.¨qÔ1Ø'¨Ô*Ø,¨QÔ/Ø+¨AÔ.ñ

ô 

ˆõ �d�EœHœOÑ,Ô,ð 	 ð	ð 	ð 	ð 0Ð/°°d´mÀWÈdÌlÑ[Ô[ˆDŒLØ�JŠJ�tÑÔÐÐà�JŠJ�wÑÔÐÐàð Ø�1Œvˆå�‰:Œ:Ðs8   É,CMÍMÍMÎ=OÏO	ÏO	Ó$AUÕU	Õ
U	)rK   FN)r>   rG   r4   Ú_utilsr   ÚhasattrÚ_CÚ__dict__Útorch._Cr   r   r   r   r   r   r1   rØ   r
   r   r   ú<module>rÞ      sŠ  ðà 	€	€	€	Ø €€€à €€€à  Ð  Ð  Ð  Ð  Ð  ð €wˆuŒxÐ*Ñ+Ô+ð à&1 k°,Ñ&?Ô&?€E„HÔ�lÑ#Ø.9¨kÐ:NÑ.OÔ.O€E„HÔÐ*Ñ+Ø:E¸+Ø(ñ;ô ;€E„HÔÐ6Ñ7ðð ð ð ð ð ð ð ð ð ð,ð ,ð ,ð ð  ð  ðD.ð D.ð D.ð D.ð D.�”Ô#ñ D.ô D.ð D.ðNFAð FAð FAð FAð FAñ FAô FAð FAðV PTðkð kð kð kð kð kr   