§
    Pzni1T  ã                   óX  — d dl Z d dlZd dlmZm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)Útree_flattenÚtree_unflattené   )Ú_dummy_typeÚ_CudaStreamBaseÚ
_CUDAGraphÚ_graph_pool_handleÚ_cuda_isCurrentStreamCapturing)r
   r   r	   c                  ó   — t          ¦   «         S )zÒ
    Returns 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
   © ó    úq/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/torch/cuda/graphs.pyÚis_current_stream_capturingr      s   € õ *Ñ+Ô+Ð+r   c                  ó   — t          ¦   «         S )zß
    Returns 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 )Ú	CUDAGraphzw
    Wrapper 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__8   s   ø€ Ý‰wŒw�Š˜sÑ#Ô#Ð#r   NÚglobalc                 óN   •— t          ¦   «                              ||¬¦  «         dS )aú  
        Begins 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_begin;   s)   ø€ õ$ 	‰Œ×Ò 4Ð<NÐÑOÔOÐOÐOÐOr   c                 óH   •— t          ¦   «                              ¦   «          dS )aP  
        Ends 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_endO   s!   ø€ õ 	‰Œ×ÒÑÔÐÐÐr   c                 óH   •— t          ¦   «                              ¦   «          dS )z?
        Replays the CUDA work captured by this graph.
        N)r   Úreplayr"   s    €r   r$   zCUDAGraph.replayZ   s   ø€ õ 	‰Œ�ŠÑÔÐÐÐr   c                 óH   •— t          ¦   «                              ¦   «          dS )zD
        Deletes the graph currently held by this instance.
        N)r   Úresetr"   s    €r   r&   zCUDAGraph.reset`   s   ø€ õ 	‰Œ�Š‰Œˆˆˆr   c                 óD   •— t          ¦   «                              ¦   «         S )zí
        Returns 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.poolf   s   ø€ õ ‰wŒw�|Š|‰~Œ~Ðr   c                 óD   •— t          ¦   «                              ¦   «         S )zB
        Enables debugging mode for CUDAGraph.debug_dump.
        )r   Úenable_debug_moder"   s    €r   r)   zCUDAGraph.enable_debug_moden   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_dumpt   s   ø€ õ ‰wŒw×!Ò! *Ñ-Ô-Ð-r   )Nr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r!   r$   r&   r   r)   r+   Ú__classcell__)r   s   @r   r   r   0   sü   ø€ € € € € ðð ð$ð $ð $ð $ð $ðPð Pð Pð Pð Pð Pð(	ð 	ð 	ð 	ð 	ðð ð ð ð ðð ð ð ð ðð ð ð ð ð+ð +ð +ð +ð +ð.ð .ð .ð .ð .ð .ð .ð .ð .r   r   c                   ó6   — e Zd ZdZdZ	 	 	 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
    Nr   r   c                 ó0  — | j         j        €(t          j                             ¦   «         | j         _        |€dn|f| _        |�|n| j         j        | _        | j        €J ‚t          j                             | j        ¦  «        | _        || _	        || _
        d S )Nr   )r   Údefault_capture_streamÚtorchÚcudaÚStreamr   Úcapture_streamÚstreamÚ
stream_ctxÚ
cuda_graphr   )r   r<   r   r:   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   )r6   r7   ÚsynchronizeÚgcÚcollectÚempty_cacher;   Ú	__enter__r<   r   r   r   )r   s    r   rC   zgraph.__enter__¶   s~   € åŒ
×ÒÑ Ô Ð Ý
Œ
‰ŒˆÝŒ
×ÒÑ Ô Ð ð 	Œ×!Ò!Ñ#Ô#Ð#à%ˆŒÔ%ØŒYð	
Ø+/Ô+Bð	
ð 	
ð 	
ð 	
ð 	
r   c                 óp   — | j                              ¦   «          | j                             |||¦  «         d S r   )r<   r!   r;   Ú__exit__)r   Úexc_typeÚ	exc_valueÚ	tracebacks       r   rE   zgraph.__exit__Ä   s6   € ØŒ×#Ò#Ñ%Ô%Ð%ØŒ× Ò  ¨9°iÑ@Ô@Ð@Ð@Ð@r   )NNr   )	r-   r.   r/   r0   r5   Ústrr=   rC   rE   r   r   r   r3   r3      sw   € € € € € ðð ð< "Ðð
 ØØ"*ð5ð 5ð
  ð5ð 5ð 5ð 5ð,
ð 
ð 
ðAð Að Að Að Ar   r3   é   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          |¦  «        \  }}‰%                     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%          ¦   «         }t           j                             ¦   «          t           j                             t           j                             ¦   «         ¦  «        5  t          | ||
¦  «        D ]˜\  }}}t#          |¦  «        D ]€}t           ||Ž ¦  «        \  }}t           j                             t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        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          |¦  «        \  }}|                     t          |¦  «        ¦  «         |                     |¦  «         ŒŽg }g }t          t5          |
¦  «        t5          |¦  «        t5          |¦  «        t5          ‰&¦  «        ¦  «        D �]B\  }}}}t          d„ |D ¦   «         ¦  «        }t           j                             ||¬¦  «        5  t           j                             t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        d|¬¦  «        }ddd¦  «         n# 1 swxY w Y   g }d}|D ]?}|j        r!|                     ||         ¦  «         |dz  }Œ*|                     d¦  «         Œ@t          |¦  «        }|                     |¦  «         |                     |¦  «         �ŒDt9          t5          |¦  «        ¦  «        }t9          t5          |¦  «        ¦  «        }d„ } g }!t;          | ¦  «        D ]¸\  }"} | ||"         ||"         ‰&|"         |	|"         ||"         |
|"         ||"         ||"         ||"         ¦	  «	        }#t	          |t           j        j        ¦  «        r6d„ }$ |$||j        |#|j        ¦  «        |_        |!                     |¦  «         Œ£|!                     |#¦  «         Œ¹|r|!d         S t          |!¦  «        S )a¸  
    Accepts 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.

    .. 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   )Ú
isinstancer6   ÚTensor)rP   Úargs     r   rR   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)rP   Úargss     r   ú
<listcomp>z*make_graphed_callables.<locals>.<listcomp>5  s   € Ð!LÐ!LÐ!L°¥# d¡)¤)Ð!LÐ!LÐ!Lr   c                 ó’   — g | ]D}t          |t          j        j        ¦  «        r!t	          |                     ¦   «         ¦  «        nd ‘ŒES )r   )rT   r6   ÚnnÚModuleÚtupleÚ
parameters)rP   Úcs     r   rZ   z*make_graphed_callables.<locals>.<listcomp>6  sP   € ð "ð "ð "àõ ",¨A­u¬x¬Ñ!?Ô!?ÐG�ˆa�lŠl‰nŒnÑÔÐÀRð"ð "ð "r   c                 ó2   •— g | ]}‰|         ‰|         z   ‘ŒS r   r   )rP   ÚiÚflatten_sample_argsÚper_callable_module_paramss     €€r   rZ   z*make_graphed_callables.<locals>.<listcomp>:  s9   ø€ ð *ð *ð *àð 	˜AÔÐ!;¸AÔ!>Ñ>ð*ð *ð *r   c                 óJ   — g | ] }t           j                             ¦   «         ‘Œ!S r   ©r6   r7   r   ©rP   Ú_s     r   rZ   z*make_graphed_callables.<locals>.<listcomp>?  ó&   € ÐHÐHÐH¨Q•%”*×&Ò&Ñ(Ô(ÐHÐHÐHr   c                 óJ   — g | ] }t           j                             ¦   «         ‘Œ!S r   rf   rg   s     r   rZ   z*make_graphed_callables.<locals>.<listcomp>@  ri   r   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rM   ©rP   Úos     r   rR   z)make_graphed_callables.<locals>.<genexpr>O  s)   è è € Ð!HÐ!H¨¸¼Ð!H !Ð!HÐ!HÐ!HÐ!HÐ!HÐ!Hr   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rM   ©rP   rb   s     r   rR   z)make_graphed_callables.<locals>.<genexpr>P  s)   è è € Ð TÐ T qÀAÄOÐ T Ð TÐ TÐ TÐ TÐ TÐ Tr   c              3   óL   K  — | ]}|j         ¯	t          j        |¦  «        V — Œ d S r   ©rN   r6   Ú
empty_likerl   s     r   rR   z)make_graphed_callables.<locals>.<genexpr>Q  sH   è è € ð 'ð 'Ø01ÀÄð'ÝÔ(¨Ñ+Ô+ð'ð 'ð 'ð 'ð 'ð 'r   )ÚoutputsÚinputsÚgrad_outputsÚonly_inputsÚallow_unusedN)r   c              3   óP   K  — | ]!}|j         rt          j        |¦  «        nd V — Œ"d S r   rq   rl   s     r   rR   z)make_graphed_callables.<locals>.<genexpr>t  sJ   è è € ð $
ð $
ØAB 1¤?Ð<�EÔ˜QÑÔÐ¸ð$
ð $
ð $
ð $
ð $
ð $
r   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rM   rl   s     r   rR   z)make_graphed_callables.<locals>.<genexpr>z  s)   è è € ÐKÐK A¸1¼?ÐK˜aÐKÐKÐKÐKÐKÐKr   c              3   ó(   K  — | ]}|j         ¯	|V — Œd S r   rM   ro   s     r   rR   z)make_graphed_callables.<locals>.<genexpr>{  s)   è è € ÐPÐP 1ÀÄÐP˜QÐPÐPÐPÐPÐPÐPr   c              3   ó   K  — | ]}|®|V — Œ	d S r   r   rl   s     r   rR   z)make_graphed_callables.<locals>.<genexpr>|  s"   è è € Ð"SÐ"S¨ÀQÀ] 1À]À]À]À]Ð"SÐ"Sr   r   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   ©Údetachrl   s     r   rR   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$   rT   r^   )Úctxrt   rb   Ú	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�   rO   s     r   rR   zkmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.Graphed.backward.<locals>.<genexpr>º  sC   è è € ð ð Ø;< ! -�A—H’H‘J”J�J°Qðð ð ð ð ð r   )rX   Úzipr„   r…   r$   rT   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‹   r6   Ú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        t          |¦  «        ‰z   Ž }t          |‰¦  «        S r   )Ú_tree_flattenÚapplyr^   Ú_tree_unflatten)Ú	user_argsÚflatten_user_argsrh   Úoutrš   Úmodule_paramsÚoutput_unflatten_specs       €€€r   ÚfunctionalizedzVmake_graphed_callables.<locals>.make_graphed_autograd_function.<locals>.functionalized¾  sE   ø€ õ $1°Ñ#;Ô#;Ñ Ð˜qØ�'”-¥%Ð(9Ñ":Ô":¸]Ñ"JÐLˆCÝ" 3Ð(=Ñ>Ô>Ð>r   )r6   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   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   ) r6   Úis_autocast_enabledÚis_autocast_cache_enabledÚRuntimeErrorrT   r^   rŽ   r\   r]   rX   Ú_backward_hooksÚ_forward_hooksÚ_forward_pre_hooksÚallÚbuffersrœ   Úappendrƒ   r   r7   r?   r:   r8   r—   r‘   r3   ÚreversedrN   ÚlistÚ	enumerater©   r‹   )'Ú	callablesÚsample_argsÚnum_warmup_itersÚallow_unused_inputÚjust_one_callabler`   rY   Úflatten_argrh   Úper_callable_len_user_argsÚ"per_callable_static_input_surfacesÚ
fwd_graphsÚ
bwd_graphsÚmempoolrª   r‰   rs   Úgrad_inputsÚ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”   r“   Úgrad_idxrV   r¦   Úretrb   r¬   r¯   rc   rd   s'                                        @@r   Úmake_graphed_callablesrÐ   Ê   sG  øø€ õ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õ
 ' tÑ,Ô,‰ˆ�QØ×"Ò"¥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åÑ!Ô!€Gõ
 
„J×ÒÑÔÐÝ	Œ×	Ò	�5œ:×,Ò,Ñ.Ô.Ñ	/Ô	/ð %ð %Ý03Ø�{Ð$Fñ1
ô 1
ð 	%ð 	%Ñ,ˆD�$Ð,õ Ð+Ñ,Ô,ð 
ð 
�Ý*¨4¨4°¨;Ñ7Ô7‘
�˜Ý#œn×1Ò1Ý!Ð!HÐ!H¨WÐ!HÑ!HÔ!HÑHÔHÝ Ð TÐ TÐ,@Ð TÑ TÔ TÑTÔTÝ!&ð 'ð 'Ø5<ð'ñ 'ô 'ñ "ô "ð !%Ø!3ð 2ñ ô ��ð ˜˜ð	%ð%ð %ð %ñ %ô %ð %ð %ð %ð %ð %ð %øøøð %ð %ð %ð %õ  
„J×ÒÑÔÐð #%ÐØ)+Ð&Ý!$ Y°¸ZÑ!HÔ!Hð 8ð 8Ñˆˆd�IÝŒZ×Ò˜i¨gÐÑ6Ô6ð 	"ð 	"Ø�d˜D�kˆGð	"ð 	"ð 	"ñ 	"ô 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"øøøð 	"ð 	"ð 	"ð 	"õ !.¨gÑ 6Ô 6Ñˆ˜Ø#×*Ò*­5°Ñ+AÔ+AÑBÔBÐBØ*×1Ò1°$Ñ7Ô7Ð7Ð7ð (*Ð$Ø&(Ð#ÝJMÝÐ3Ñ4Ô4ÝÐ,Ñ-Ô-Ý�ÑÔÝÐ+Ñ,Ô,ñ	Kô Kð #Cñ #CÑFÐ˜n¨i¸õ $ð $
ð $
ØFTð$
ñ $
ô $
ñ 
ô 
Ðõ ŒZ×Ò˜i¨gÐÑ6Ô6ð 	ð 	Ýœ.×-Ò-ÝÐKÐK¨ÐKÑKÔKÑKÔKÝÐPÐPÐ(<ÐPÑPÔPÑPÔPÝ"Ð"SÐ"SÐ.AÐ"SÑ"SÔ"SÑSÔSØ Ø/ð .ñ ô ˆKð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð  ÐØˆØ'ð 	0ð 	0ˆCØÔ ð 0Ø"×)Ò)¨+°hÔ*?Ñ@Ô@Ð@Ø˜A‘��à"×)Ò)¨$Ñ/Ô/Ð/Ð/Ý"Ð#5Ñ6Ô6Ðà(×/Ò/Ð0CÑDÔDÐDØ'×.Ò.Ð/AÑBÔBÐBÑBõ (,­HÐ5UÑ,VÔ,VÑ'WÔ'WÐ$Ý&*­8Ð4SÑ+TÔ+TÑ&UÔ&UÐ#ð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   É"B+LÌLÌ!LÍ?NÎN	ÎN	Ñ2A*S(Ó(S,	Ó/S,	)rJ   F)r@   r6   Útorch.utils._pytreer   rœ   r   rž   Ú_utilsr   ÚhasattrÚ_CÚ__dict__Útorch._Cr
   r   r	   r   r   r   r3   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ðð ð ð ð ð ð ð ð ð ð,ð ,ð ,ð ð  ð  ðL.ð L.ð L.ð L.ð L.�”Ô#ñ L.ô L.ð L.ð^GAð GAð GAð GAð GAñ GAô GAð GAðX DIðbð bð bð bð bð br   